Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

specific user can only access to certain files, images, forum etc.


Go to End


1238 Views

Avatar
ihaveqquestion

Community Member, 12 Posts

29 October 2013 at 2:01pm

Hey there,

Im quite new to website building.

currently, what we wish to achieve is that for each user, he or she can only access to specific content of the website with same presentation. According to username, one user can his/her image, files, forum etc. and the rest documents for other users are hidden.
also everything needs to be done under one domain.

can someone tell me how i need to structure it? I have done a bit research regarding MCV. I have drafted unfinished code as following, (newpage.php in mysite/code)

<?php
class NewPage extends Page {

}
class NewPage_Controller extends Page_Controller {

static $allowed_actions = array(
'NewPage'

public function NewPage(){

$this->load->model('login_model');
$data['Member'] = $this->login_model->get_member();
$this->load->view('Page', $data);

if ($member = Member::currentUser())
{

$sqlQuery = new SQLQuery();

$sqlQuery= "SELECT GroupID from Group_Members where MemberID='.$member->ID'"

$rawSQL = $sqlQuery->sql();
$result = $sqlQuery->execute();
$groupid = $result->first();
}

else {
}

}
}

thanks for your help in advance.