"Member Only&q...
 
Notifications
Clear all

"Member Only" section discussion

9 Posts
3 Users
0 Likes
2,206 Views
(@calash)
Posts: 180
Estimable Member
Topic starter
 

I did some searching but could not find anything so I thought I would bring this up here as a potential mod.

One of my members has expressed interest in a "member only" section of the story archive in a similar way you can set a rating to require membership.  It could be a category, a classification, or something different that marks a story as such.

My first thought is to work in queries.php and work off of _STORYQUERY and filter out the stories based on the logged in status there.  However I am having issues with phpMyAdmis so I cannot view the database at the moment to see how things go together.

That aside I am curious if this has been discussed before or if anybody has tried this and has any ideas that I could try to build off of.

Thanks

The World of Necrotania - Story Writing Community

 
Posted : 20/12/2010 11:35 am
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Finally got into the database so I could take a look.

I could see doing this via Queries.php by hard coding a check for ether a catid or a classes number and if the current user is logged in.

ie:

If USERUID=FALSE
- _STORYQUERY Query with Catid filter
ELSE
- Regular _STORYQUERY

I still have to check the code in other places and see how this is used elsewhere.

The World of Necrotania - Story Writing Community

 
Posted : 20/12/2010 11:47 am
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Working in Queries.php has a problem.  It is called before get_session_variables.php so you can not use USERUID to check and see if the person is registered and logged in. 

It looks like the best bet for this path would be to move _STORYQUERY to Get_session_variables.php and have it constructed after the USERUID constant is set.  Not the prettiest solution but it would get the job done...well partly.

The down side of this approach is that it only hides filtered stories.  If you know the direct URL you can still read them.  Any external scripts that do not use Queries.php and/or get_session_variables.php will ignore the changes as well. 

I will have to dig around a bit and see if there are any other good options for this type of setup.

The World of Necrotania - Story Writing Community

 
Posted : 20/12/2010 1:27 pm
(@tammy)
Posts: 2577
Member Moderator
 

You're also going to have issues with multi-category stories.  If it's in the member's only section category AND in a public category is it member's only or public?  I looked into this for v4 and while the coding is possible (in fact it should be fairly easy to MOD in v4), I cringed at the UI implications and gave up the idea.  It'll probably work okay for a single archive where the admins can explain very clearly how it works, I just couldn't see being able to manage the questions, confusion, and problems it would bring up as a generic option.

For the issue with viewstory.php (which should be the only thing that doesn't use queries.php....and I'm not sure viewstory.php doesn't) you'd need to add something to the ratings check at the beginning of the file.

 
Posted : 20/12/2010 1:59 pm
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Thats funny, I was just looking at viewstory.php and seeing how I could adapt the current rating code to get by the direct URL problem.  

The current code I am playing with is extracted from your class.php, where you make use of FIND_IN_SET() for handling multiple classes per story.  In this case adding the story to the member only group would override any other selections.  For my users I think this would be acceptable.

Of course, I probably could just go with the same idea as the current rating code has and only filter at the viewstory.php level.  That method works perfectly fine for ratings, so it should be acceptable for this setup.

Edit:  I have viewstory.php filtering setup and working very well.  This may be fine for my needs.

Currently it is using a class but I think having it check for catid would be easy.

For anybody curious here is the line of code.


// Check for Member-Only class
$search = "16";
if (strstr($storyinfo['classes'], $search) && !isMEMBER) $warning = _RUSERSONLY."<br />";

Added before the following line


// if the above checks came back with a warning, output an error page.

This is hard coded to a class with the ID number 16.  If anybody wants to use this on their own sites you will have to alter the code to suit your setup. 

The World of Necrotania - Story Writing Community

 
Posted : 20/12/2010 3:15 pm
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Found a problem with this approach.  It works perfectly for stories, but Series can also select the class/category but do not have the same filtering ability.

Minor issue...can ether add some code to viewseries.php or change the wording of the selection.

The World of Necrotania - Story Writing Community

 
Posted : 21/12/2010 10:34 am
(@tammy)
Posts: 2577
Member Moderator
 

// Check for Member-Only class
$search = "16";
if (strstr($storyinfo['classes'], $search) && !isMEMBER) $warning = _RUSERSONLY."<br />";

You've got a problem here too.  If 16 is the first class listed (or the only class) it'll return 0.  You probably want:


// Check for Member-Only class
$search = "16";
if (in_array($search, explode(",", $storyinfo['classes'])) && !isMEMBER) $warning = _RUSERSONLY."<br />";
 
Posted : 23/12/2010 12:14 am
(@calash)
Posts: 180
Estimable Member
Topic starter
 

Your right...totally missed that.  Thank you.

I have my site running a member-only category right now.  Just changed the $storyinfo[classes] to $storyinfo[catid].  I am updating the code with your corrected code now.

The World of Necrotania - Story Writing Community

 
Posted : 23/12/2010 10:53 am
(@undrockroll)
Posts: 41
Eminent Member
 

We've done something like this - we have "Paid Members" and what I did was heavily modify the Level 4 Admins so that they can't do anything extra, only see links that the "Admin" ranks are able to see. Also they have access to special skins, and stuff. Kind of neat. πŸ™‚

 
Posted : 21/01/2011 4:55 pm
Share: