Recent Topics

Browse own posts only BUT not the rest of the blog

Started by on Jun 15, 2012 – Contents updated: Dec 07, 2012

Jun 15, 2012 23:43    

I want to allow a user to create posts and edit them BUT not be able to browse the rest of the blog. Is that possible, I can't seem to get the desired effect. Thank you.

Oct 06, 2012 20:10

You mean only see and edit their own posts.OR
See all posts but edit only his/hers

Oct 06, 2012 20:14

There's no such option in backoffice. However what you can do is set this restriction directly in /inc/items/model/_item.funcs.php line 69

If user group ID is #5 display his own posts only

replace this

// pre_dump( $MainList->default_filters );
$MainList->load_from_Request( false );


with this

// pre_dump( $MainList->default_filters );
$MainList->load_from_Request( false );

global $current_User;
if( $current_User->group_ID == 5 )
{	// Display items created by or assigned to current user only
	$MainList->set_filters( array(
			'author_assignee' => $current_User->ID,
		) );
}

Oct 06, 2012 20:17

Moved to feature requests

Oct 06, 2012 20:34

Actually it would be better to edit /inc/items/model/_itemlistlight.class.php line 410. That way your setting will be applied to all kind of post lists.

[color=red]NOTE: You will still be able to see individual posts.[/color]

replace

/*
 * Restrict to selected author or assignee:
 */
$this->filters['author_assignee'] = param( $this->param_prefix.'author_assignee', '/^[0-9]+$/', $this->default_filters['author_assignee'], true );


with

global $current_User;
if( $current_User->group_ID == 5 )
{    // Display items created by or assigned to current user only
    $this->filters['author_assignee'] = $current_User->ID;
}
else
{
	/*
	 * Restrict to selected author or assignee:
	 */
	$this->filters['author_assignee'] = param( $this->param_prefix.'author_assignee', '/^[0-9]+$/', $this->default_filters['author_assignee'], true );
} 

Also I assume that your blog is already for members only, i.e. only logged in users can browse it.

Oct 06, 2012 21:16

Thanks a lot. Yes tilqicom I meant the former. The scenario I would like to see is inviting a user to write a draft post and I will publish it. They would be able to edit it as well afterwards. Apart from that I don't want them to have any other privileges, including see any other posts or stats in the backoffice. Thanks a lot for the code I will experiment with that. I'm not sure about the blog being for members only.

Oct 06, 2012 21:52

This doesn't seem to work for me. I still see 'recent drafts' 'recent edits' and 'browse posts'. Or have I misunderstood? Also when I log out as a 'blogger' I get this:
Notice: Trying to get property of non-object in /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php on line 411

Warning: Cannot modify header information - headers already sent by (output started at /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php:411) in /home/mogator/public_html/blogs/inc/_core/_template.funcs.php on line 59

Warning: Cannot modify header information - headers already sent by (output started at /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php:411) in /home/mogator/public_html/blogs/inc/_core/_template.funcs.php on line 248

Warning: Cannot modify header information - headers already sent by (output started at /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php:411) in /home/mogator/public_html/blogs/inc/_core/_template.funcs.php on line 249

Warning: Cannot modify header information - headers already sent by (output started at /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php:411) in /home/mogator/public_html/blogs/inc/_core/_template.funcs.php on line 250

Warning: Cannot modify header information - headers already sent by (output started at /home/mogator/public_html/blogs/inc/items/model/_itemlistlight.class.php:411) in /home/mogator/public_html/blogs/inc/_core/_template.funcs.php on line 251

Oct 07, 2012 00:51

To get rid of errors, replace this

if( $current_User->group_ID == 5 ) 


with

if( is_logged_in() && $current_User->group_ID == 5 )

What's the reason to hide posts from users if they can see those posts while logged out anyway? You need to make your blog/s available to logged in users only.

Oct 07, 2012 09:52

Thanks I'll try that to remove the errors, although presumably that won't affect the fact that it doesn't hide the post lists. There are a number of reasons why I would like to make a guest blogger (who I may not know very well if at all) only be able to view his/her post and nothing else. I would have thought this would be a common request to be honest. Draft blogs can be seen as blogger. That is a big no no for me as some of the articles will be exclusives with an embargo attached to them. I wouldn't want other writers viewing these. I also don't particularly want guest writers to compare stats attached to other writers' posts. I can just receive articles and post them myself, which is what I'm doing now but the benefit of having people log in and post/edit/answer comments etc should be obvious.It decentralises things so relieves the burden on our team and it encourages participation (pic etc. and replying to comments directly).

Oct 07, 2012 16:37

Ok, I see what you mean. We definitely need dedicated "view any" and "view own" permissions in group/user settings. As of now it can be done only with extensive hacking of core files.

Oct 08, 2012 15:34

mojolazarus: can you clearly describe the use case for this? What are you trying to do? (in terms of workflow, not in technical details)

Oct 08, 2012 21:25

Hi fplanque
sure: I need to invite certain guests to publish posts (maybe as draft for some people as we sometimes publish bilingually. So post statuses should do this) logged in as themselves. They can't see anything else but they could edit the post afterwards and reply to comments when logged in. I think Sam's view any/view own sounds exactly right for this situation. It wouldn't make sense for a once a year guest poster to have their own blog. Does that make sense?

Oct 12, 2012 00:19

So I do understand you have guest posters. It would not make sense for them to have their own blog. granted.

Replying to comments is always possible. Being able to editing their own posts only is already an option in the advanced permissions. So what's missing?

"They can't see anything else" does not make sense to me. Th eonly thing that I can understand in this use case is that you would want guest posters to NOT be able to see drafts from other guest posters.

To address this, we are introducing a new status in V5 called "Review". Posts that are in review can only be seen by the author and moderators. You can give your guest posters permission to only see "review" and "public" posts (no permission to see drafts).

Does that make sense for you?

Oct 13, 2012 00:46

yes 'can't see anything else' means exactly that; they cannot see any other posts or information. Sam's notion of view any versus view own encapsulates the desired effect most parsimoniously, for me at least. I'm not sure that it can be reduced any further. The review status sounds like it would approximate the effect. If one did not want guests to compare view stats then the status assigned to guests would be only see "review". But then that might not be a feature that many others would want, I don't know.

Oct 20, 2012 18:04

No, the status you would have for your guest posters is this: "can post and edit only with review status".

And when a post is in review status, they CANNOT see it unless it's their own.

Only moderators can see posts under review that have been created by other users.


Form is loading...

Secure CMS – This forum is powered by b2evolution CMS, a complete engine for your website.