Welcome to Geeklog, Anonymous Monday, December 30 2024 @ 05:16 pm EST
Geeklog Forums
Making 'read more' accessible to registered users only
Gush
Anonymous
How do i make 'read more' accessible to registered users only? such that guest users are prompted to register when the click on 'read more'
5
8
Quote
Status: offline
lbpp
Forum User
Chatty
Registered: 06/10/05
Posts: 57
After reading what has been done in the past, are these hacks still good for the current release of GL? I think this is one of the best ways to "entice" viewers to register for your site. You lure them in with the intro text and then make them register to read the good stuff.
5
7
Quote
Gush
Anonymous
Is there an easy way of doing it guys?
6
7
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
Here's a 1.4 compatible method. Problem really is that GL is not really designed for hiding stories. It's designed for getting information out there.
In public_html/article.php replace
PLG_replaceTags (stripslashes ($A['introtext'])));
$story_template->set_var ('story_bodytext',
PLG_replaceTags (stripslashes ($A['bodytext'])));
with
PLG_replaceTags (stripslashes ($A['introtext'])));
if (isset($_USER['uid']) and $_USER['uid'] > 1)
{
$story_template->set_var ('story_bodytext',
PLG_replaceTags (stripslashes ($A['bodytext'])));
}
And insert
{
$show_comments = false;
}
After this comment
In /path2GL/system/lib-story.php, modify these lines
if( !empty( $A['bodytext'] ))
{
$bodytext = stripslashes( $A['bodytext'] );
}
to look like this
// someday add a $_CONF['anonmustregtoread'] or even better a $A['regusersonly'] != 0 to this
$hideregonlycontent = (!isset($_USER['uid']) or $_USER['uid'] <= 1);
if( !empty( $A['bodytext'] ))
{
if ($hideregonlycontent)
{
// move this into a $LANG array
$bodytext = '<a href="' . COM_buildUrl($_CONF['site_url'] . '/users.php?mode=new') . '">Register</a> to read the rest of this story.';
}
else
{
$bodytext = stripslashes( $A['bodytext'] );
}
}
And this line:
becomes this
And that should do it.
In public_html/article.php replace
Text Formatted Code
$story_template->set_var ('story_introtext',PLG_replaceTags (stripslashes ($A['introtext'])));
$story_template->set_var ('story_bodytext',
PLG_replaceTags (stripslashes ($A['bodytext'])));
Text Formatted Code
$story_template->set_var ('story_introtext',PLG_replaceTags (stripslashes ($A['introtext'])));
if (isset($_USER['uid']) and $_USER['uid'] > 1)
{
$story_template->set_var ('story_bodytext',
PLG_replaceTags (stripslashes ($A['bodytext'])));
}
Text Formatted Code
if (!isset($_USER['uid']) or $_USER['uid'] <= 1){
$show_comments = false;
}
Text Formatted Code
// Display the comments, if there are any ..In /path2GL/system/lib-story.php, modify these lines
Text Formatted Code
$bodytext = '';if( !empty( $A['bodytext'] ))
{
$bodytext = stripslashes( $A['bodytext'] );
}
Text Formatted Code
$bodytext = '';// someday add a $_CONF['anonmustregtoread'] or even better a $A['regusersonly'] != 0 to this
$hideregonlycontent = (!isset($_USER['uid']) or $_USER['uid'] <= 1);
if( !empty( $A['bodytext'] ))
{
if ($hideregonlycontent)
{
// move this into a $LANG array
$bodytext = '<a href="' . COM_buildUrl($_CONF['site_url'] . '/users.php?mode=new') . '">Register</a> to read the rest of this story.';
}
else
{
$bodytext = stripslashes( $A['bodytext'] );
}
}
Text Formatted Code
$show_comments = true;Text Formatted Code
$show_comments = !$hideregonlycontent;And that should do it.
5
6
Quote
All times are EST. The time is now 05:16 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content