Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Page for people who are not members of the group

UserPost

2:45 pm
March 3, 2009


gentalk

Member

posts 2

1

First and foremost - GREAT plugin - working within 15 minutes - exactlry what I want !


However -


If I request a page which I have assigned to a group (when logged in as a member of that group) it works ok - - I get a blank page when I attempt to try and see that page from another (non-group) member.

How do I customise that page so it says something sensible - I can do the html/php etc etc to make the page content what I want - I just cant figure out where in the options pages it says "display THIS page ifattempt is made by a non group member" -


Appreciate any help


Andrew

11:31 am
March 5, 2009


Kevin

Admin

posts 2402

2

What do you mean by a blank page? The same page you would see if someone requests something that doesn't exist? If so, this is a theme issue. You should be able to edit your 404.php file to display whatever you want. If necessary, you do this to check for group membership:

global $current_user;
if ( isset( $current_user->groups[$group_id]) ) {
  // display your special message
}

3:51 am
March 6, 2009


gentalk

Member

posts 2

3

Thanks for the reply - I dont think I specified in the original post enough information.

Whilst I can edit the 404.php page to check for the group that the users is in, that will work for ANY page request that comes in that doesnt exist - not specifically for requests for a page that DOES exist but the rolescoper plugin is refusing access to.

I'd like to be able to cater for the situation where a valid page exists, but role scoper is disallowing access, and present a page that says something like "please register to be able to view this page" (or whatever) - as opposed to a generic "page not found" whenever a truly non-existent page is requested.


Does this make sense ? Laughing

Thanks for a great plugin and your help so far.

2:35 pm
March 9, 2009


Kevin

Admin

posts 2402

4

Here's how you can check whether a requested post actually exists:

global $wp_query, $wpdb;

if ( ! empty($wp_query->query_vars['name']) ) {
  if ( $wpdb->get_var( sprintf("SELECT ID FROM $wpdb->posts WHERE post_name = '%s'", $wp_query->query_vars['name'] ) ) ) {

  // echo your custom message here
}

Starting with the next version of Role Scoper, you can do this instead:

if ( post_exists_rs() ) {
  // echo your custom message here
}

About the Agapetry forum

Currently Online:

15 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1186

Posts: 5409

Members:

There are 1176 members

There are 1 guests


Kevin has made 2402 posts

Top Posters:

metal450 - 159

Ragnar - 105

YikYak - 70

whiteorb - 44

Daisy - 35

Administrator: Kevin | Moderators: Kevin