Welcome to Geeklog Tuesday, September 29 2020 @ 04:29 pm EDT

Geeklog Forums

What is the final Solutition for "Login to Read More"


Tor

Anonymous
I have read a lot of posts in relation to logging in to read more but the code I have seen relate to older versions of Geeklog or do not prevent direct access via a complete link, some solutions prevent search engines from using spiders.

I would like to know if anyone has a Solution for the current version of Geeklog preferably one that can be implemented from the configuration menu.

 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 14/01/05
Posts: 1569
Location:la rochelle, France
Hi Tor,

The final solution with programming do not exist. A way to solve your issue is to hack article.php and test if user is an anonymous. For exemple:

Add Line 111
PHP Formatted Code
if ($A['count'] > 0 && !COM_isAnonUser()) {

and hack lib-story.php

Replace Line 324-342
PHP Formatted Code
if( !empty( $bodytext ) && !COM_isAnonUser())
        {
            $article->set_var( 'lang_readmore', $LANG01[2] );
            $article->set_var( 'lang_readmore_words', $LANG01[62] );
            $numwords = COM_numberFormat(count(explode(' ', COM_getTextContent($bodytext))));
            $article->set_var( 'readmore_words', $numwords );

            $article->set_var( 'readmore_link',
                COM_createLink(
                    $LANG01[2],
                    $articleUrl,
                    array('class'=>'story-read-more-link')
                )
                . ' (' . $numwords . ' ' . $LANG01[62] . ') ' );
            $article->set_var('start_readmore_anchortag', '<a href="'
                    . $articleUrl . '" class="story-read-more-link">');
            $article->set_var('end_readmore_anchortag', '</a>');
            $article->set_var('read_more_class', 'class="story-read-more-link"');
        } else if ( !empty( $bodytext ) ) {
                    $article->set_var( 'lang_readmore', 'Login to read more');
            $article->set_var( 'lang_readmore_words', 'Login to read more' );
            $numwords = COM_numberFormat(count(explode(' ', COM_getTextContent($bodytext))));
            $article->set_var( 'readmore_words', $numwords );

            $article->set_var( 'readmore_link',
                COM_createLink(
                    $LANG01[2],
                    $_CONF['site_url'] . '/users.php',
                    array('class'=>'story-read-more-link')
                )
                . ' (' . $numwords . ' ' . $LANG01[62] . ') ' );
            $article->set_var('start_readmore_anchortag', '<a href="'
                    . $_CONF['site_url'] . '/users.php" class="story-read-more-link">');
            $article->set_var('end_readmore_anchortag', '</a>');
            $article->set_var('read_more_class', 'class="story-read-more-link"');
                }


::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 04:29 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