Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Doug Heffernan on March 04, 2018, 04:49:03 PM

Title: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Doug Heffernan on March 04, 2018, 04:49:03 PM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=4169)

What does this mod do?


What about search bots?


Installation.


Configuration.

The mod adds its own tab with 2 settings in the Modification Settings. The mod tab is called Limit Guest Views Settings. One setting is to enter the number of thread views that a guest can have before getting the error message. The other setting is to exclude individual boards from this limit.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: -Rock Lee- on March 04, 2018, 07:04:23 PM
It seems pretty good let's try it also I leave the translations into Latin Spanish ;D

Code (Help.spanish_latin.php) Select
$helptxt['num_views'] = 'Este campo de configuración contiene el número de visitas que desea limitar a sus invitados para ver su foro. Una vez que se haya alcanzado el número de visitas, los invitados ya no podrán ver su foro. Tendrán que registrar una nueva cuenta o iniciar sesión.';
$helptxt['excluded_boards'] = 'Ingrese la(s) identificación(es) del(os) foro(s) que desea excluir del límite de vista. Para excluir más de una placa, separe los identificadores con una coma. es decir, 1,2,3,4';


Code (Help.spanish_latin-utf8.php) Select
$helptxt['num_views'] = 'Este campo de configuración contiene el número de visitas que desea limitar a sus invitados para ver su foro. Una vez que se haya alcanzado el número de visitas, los invitados ya no podrán ver su foro. Tendrán que registrar una nueva cuenta o iniciar sesión.';
$helptxt['excluded_boards'] = 'Ingrese la(s) identificación(es) del(os) foro(s) que desea excluir del límite de vista. Para excluir más de una placa, separe los identificadores con una coma. es decir, 1,2,3,4';


Code (Modifications.spanish_latin.php) Select
$txt['guestviews_settings'] = 'Limitar la configuración de visitas de invitados';
$txt['num_views'] = 'Ver Límite';
$txt['excluded_boards'] = 'Foros excluidos';
$txt['views_reached_error_message'] = 'Has alcanzado el número m&aacute;ximo de %s vistas establecidas por el administrador. Si desea continuar viendo el resto de los temas en nuestro foro, debe <a href="./index.php?action=login">Iniciar sesi&oacute;n</a> o <a href="./index.php?action=register">Reg&iacute;strarte</a>.';


Code (Modifications.spanish_latin-utf8.php) Select
$txt['guestviews_settings'] = 'Limitar la configuración de visitas de invitados';
$txt['num_views'] = 'Ver Límite';
$txt['excluded_boards'] = 'Foros excluidos';
$txt['views_reached_error_message'] = 'Has alcanzado el número máximo de %s vistas establecidas por el administrador. Si desea continuar viendo el resto de los temas en nuestro foro, debe <a href="./index.php?action=login">Iniciar sesión</a> o <a href="./index.php?action=register">Regístrarte</a>.';



Regards!
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: byproduct on March 21, 2018, 05:50:44 AM
TY for the mod.
I like the idea. DL'd, saving for when I get SMF setup.

NOT NIT PICKING, just letting you know about a almost INSIGNIFICANT typo - "inndex".
"GuestViews.xml". Line 94 "//Search engines will not inndex the error for guests"

Promise you, I am the last one that will complain about typing

Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 01, 2018, 07:00:35 AM
I do not think that warning text translation would be needed,  if this message was editable by the forum admin.
Food for thought about the next version.    :)
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 01, 2018, 07:16:34 AM
At Modification Settings menu, I do not see complete name of mod description ?  Only letter L   ? 

I think that mod description name when installed, it should become : LTV-Guests  ( for a shorter characters length)


Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: shinglis on April 02, 2018, 03:37:10 PM
anyone using and seeing an increase in registrations ?? just curious if actually has the desired effect.

My concern would be that guest would just stop viewing the forum totally, but that's the challenge to get more registrations and more posts.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 02, 2018, 04:02:40 PM
Quote from: shinglis on April 02, 2018, 03:37:10 PM
anyone using and seeing an increase in registrations ?? just curious if actually has the desired effect.

My concern would be that guest would just stop viewing the forum totally, but that's the challenge to get more registrations and more posts.

This is a good question, I am using this mod for 24 hours and I have adjust the limit at 8 page loads.
I will test it for three months prior making any conclusion.
My forum this is six years old and overloaded with quality technical content, this mod it does help my new strategy as content creator.
No one supports any one today due donations, therefore if they wish to continue getting free food, at least they should be forced to register, so the forum to look alive too.

Fresh made Forum with out worthy content, does not need this mod. 

Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: shinglis on April 02, 2018, 04:24:04 PM
Quote from: Kiriakos GR on April 02, 2018, 04:02:40 PM
Quote from: shinglis on April 02, 2018, 03:37:10 PM
anyone using and seeing an increase in registrations ?? just curious if actually has the desired effect.

My concern would be that guest would just stop viewing the forum totally, but that's the challenge to get more registrations and more posts.

This is a good question, I am using this mod for 24 hours and I have adjust the limit at 8 page loads.
I will test it for three months prior making any conclusion.
My forum this is six years old and overloaded with quality technical content, this mod it does help my new strategy as content creator.
No one supports any one today due donations, therefore if they wish to continue getting free food, at least they should be forced to register, so the forum to look alive too.

Fresh made Forum with out worthy content, does not need this mod.

Yes sounds like ideal for your forum, where mine is very limited (2 years old) and already has a limited potential registration scope so I don't really want to alienate them more than I have to.  Might have to dig into the stats a little more deeper and see how many visits / guests I actually have  :D
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 02, 2018, 04:47:53 PM
Quote from: shinglis
Might have to dig into the stats a little more deeper and see how many visits / guests I actually have  :D

Forum Stats this is a weird mix of: search engines indexing bots (welcome activity) , website tracking engines send by web-hosting data centers, spam bots trying to register, crime prevention bots, and a few real people using known telecom brands as internet providers.
In past 12 months I do IP Block  due server configuration at data-center bots and anyone else who is unknown company which visiting my server.
In few months ahead my stats they would become more realistic, because I am now in control and always staying alerted.
 

Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 06, 2018, 08:49:59 AM
My SMF error log gets full of my own IP when I am logging at my forum.

2: Illegal string offset 'page_title'
File: /home/1234SMF/public_html/forum/Sources/GuestViewLimitSettings.php
Line  ==>9:    
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));

Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Rob Lightbody on April 07, 2018, 01:17:06 PM
Quote from: Kiriakos GR on April 06, 2018, 08:49:59 AM
My SMF error log gets full of my own IP when I am logging at my forum.

2: Illegal string offset 'page_title'
File: /home/1234SMF/public_html/forum/Sources/GuestViewLimitSettings.php
Line  ==>9:    
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));

I am having the same problem.

https://www.theqe2story.com/forum/index.php?action=admin;area=logs;sa=errorlog;desc
https://www.theqe2story.com/forum/index.php?action=admin;area=logs;sa=errorlog;desc
2: Illegal string offset 'page_title'
File: /home/public_html/forum/Sources/GuestViewLimitSettings.php
Line: 9


Also, the title for the message that pops up for a guest says "An Error Has Occurred!" - which is nasty.  It needs to say something softer like "Maximum guest views reached, please login" 

I love the idea of this mod, but I've uninstalled it because of the above 2 points.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 07, 2018, 02:19:24 PM
I am seeing the glass as half-full, and I got a few new members.

My own question this is if the person whom made this mod, if he does take under consideration the feedback that we provide?

He looks silent for a month time.     
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Doug Heffernan on April 07, 2018, 05:25:05 PM
Quote from: The QE2 Story Forum on April 07, 2018, 01:17:06 PM
Quote from: Kiriakos GR on April 06, 2018, 08:49:59 AM
My SMF error log gets full of my own IP when I am logging at my forum.

2: Illegal string offset 'page_title'
File: /home/1234SMF/public_html/forum/Sources/GuestViewLimitSettings.php
Line  ==>9:    
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));

I am having the same problem.

https://www.theqe2story.com/forum/index.php?action=admin;area=logs;sa=errorlog;desc
https://www.theqe2story.com/forum/index.php?action=admin;area=logs;sa=errorlog;desc
2: Illegal string offset 'page_title'
File: /home/public_html/forum/Sources/GuestViewLimitSettings.php
Line: 9


Also, the title for the message that pops up for a guest says "An Error Has Occurred!" - which is nasty.  It needs to say something softer like "Maximum guest views reached, please login" 

I love the idea of this mod, but I've uninstalled it because of the above 2 points.
Quote from: Kiriakos GR on April 06, 2018, 08:49:59 AM
My SMF error log gets full of my own IP when I am logging at my forum.

2: Illegal string offset 'page_title'
File: /home/1234SMF/public_html/forum/Sources/GuestViewLimitSettings.php
Line  ==>9:    
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));


I can not reproduce that error myself. I can not fix something that I can not reproduce.

An Error Has Occurred! is the Smf standard language that outputs errors. It is not added by my mod.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: vii on April 07, 2018, 09:49:37 PM
From what I can tell, your code is treating the $txt string entry as an array:


return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));


Should be:


return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings'], '')));


no? Since it's defined as:


$txt['guestviews_settings'] = 'Limit Guest Views Settings';


in GuestView.xml

-

Also, in regards to QE2's error message title request, I think it could 'fixed' if this code was added before the fatal_lang_error function call (GuestView.xml):


//Throw the error when view limit is reached
              fatal_lang_error('views_reached_error_message', false, array($modSettings['num_views']));


Change to:


//Throw the error when view limit is reached
$context['error_title'] = 'Custom title';
              fatal_lang_error('views_reached_error_message', false, array($modSettings['num_views']));


Although since this is kind of a special request, maybe best left up to each individual to add manually if they so wish.

Either way, good idea/mod doug_ips.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on April 08, 2018, 04:49:16 AM
Quote from: doug_ips

I can not reproduce that error myself. I can not fix something that I can not reproduce.

Here are few more clues:
a) My SMF Ver 2.0.15
b) Every page load made by administrator account, this is recorded by Error log.
c) In my attempt to clear  Error log ( delete old entries) a new one this is instantly generated. 
d) I am using several other mods all working in harmony, in the past three years.
e)  I am an electrician and electronics specialist, I do not do codding.

Quote from: doug_ipsAn Error Has Occurred! is the Smf standard language that outputs errors. It is not added by my mod.

Warning pop-up message title,  this is a much lesser significant  detail.

In summary :
a) Mod text description this is very long, and rename this is required.
+
b) Every page load made by administrator account, this is recorded by Error log.
c) In my attempt to clear  Error log ( delete old entries) a new one this is instantly generated. 
d) I am using several other mods all working in harmony, in the past three years.
e)  I am an electrician and electronics specialist, I do not do codding, but I can return feedback if you request it, by you saying of what you need.  :)   
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: efk on June 16, 2018, 08:49:53 PM
Interesting idea, make possible to change text on that page which is displayed as error for limitation.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on August 21, 2018, 08:52:23 AM
I am starting to believe that this Mod code this is work of another programmer, this is why there is no support of any type from this person.
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: landyvlad on September 04, 2018, 02:33:50 AM
Quote from: Kiriakos GR on August 21, 2018, 08:52:23 AM
I am starting to believe that this Mod code this is work of another programmer, this is why there is no support of any type from this person.

If you look here https://custom.simplemachines.org/mods/index.php?mod=4169 you will see that doug_ips is the author.

He has already stated that:
QuoteI can not reproduce that error myself. I can not fix something that I can not reproduce.

Obviously he'll need more information from you so he might be able to investigate further.

Remember too, that doug_ips will have a life outside SMF and is also offering this mod (and three others) for free.  He can't be expected to meet your timetable for resolution of issues. His priorities don't necessarily align with yours. I'm sure he'll be along at some point and let you know what he needs from you.


As far as your problem is concerned
QuoteNo one supports any one today due donations, therefore if they wish to continue getting free food, at least they should be forced to register, so the forum to look alive too.
there are a number of other ways to approach that problem too. 

You could always set-up your forum so that only registered members can download technical documents etc.

If you do a search, there are a number of posts regarding such issues and generating income from a forum (even if just to support the running costs).
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kiriakos GR on September 04, 2018, 05:30:21 AM
By all this amount of reported issues by me and others, and also by our demonstrated willingness about us to further assist with clues about troubleshooting, the conclusion this is that we are not the insane ones or the unreasonable ones.


Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: delta5 on November 27, 2018, 12:25:28 PM
I'm running 2.0.15 and I installed this mod with no errors so far. Can anyone tell me how the cookie settings should be set? I'm using https with a security cert. Also I have the Sucuri firewall installed. So far I have not been able to see the limit warning pop up while testing.

Thx
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kathryn_ on June 17, 2019, 05:43:31 PM
I understand this is an old post but I hope someone would be able to help me.. the mod works and the only reason I have it is because I don't use attachments, and post directly with a button .
the error of the mod appears on my logs like this:


9:    return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' =>            array(sprintf($txt['guestviews_settings']['page_title'], '')));

I have removed this mod more than once I really would like to have it.

my forum is run on installation 2.0.15
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Kathryn_ on July 01, 2019, 04:03:20 PM
Quote from: Kathryn_ on June 17, 2019, 05:43:31 PM
I understand this is an old post but I hope someone would be able to help me.. the mod works and the only reason I have it is because I don't use attachments, and post directly with a button .
the error of the mod appears on my logs like this:


9:    return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' =>            array(sprintf($txt['guestviews_settings']['page_title'], '')));

I have removed this mod more than once I really would like to have it.

my forum is run on installation 2.0.15

With the configurations from Virginia posted earlier  It saved my forum  thank you I now have the mod working without an error and the title shows perfect in Admin Panel   thank you!
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Sectomy on July 19, 2020, 10:48:40 AM
same here as Kiriakos,
same error message
2: Illegal string offset 'page_title'

any ideas ? :)
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Shambles on July 19, 2020, 11:26:18 AM
Quote from: Sectomy on July 19, 2020, 10:48:40 AM
same here as Kiriakos,
same error message
2: Illegal string offset 'page_title'

any ideas ? :)

Did you try the solution offered earlier in the thread?

https://www.simplemachines.org/community/index.php?topic=559168.msg3968507#msg3968507
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Sectomy on July 19, 2020, 12:31:03 PM
For all others who got this:
2: Illegal string offset 'page_title'
in Error Log, do this:

Code:
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings']['page_title'], '')));


Should be:

Code:
return $admin_areas['config']['areas']['modsettings']['subsections'] += array('guestviews' => array(sprintf($txt['guestviews_settings'], '')));




in GuestViewLimitSettings.php

thanx  ! :D
Title: Re: Limit Thread Views for Guests -- Motive Guests to Register
Post by: Sectomy on July 19, 2020, 12:33:37 PM
Quote from: Shambles on July 19, 2020, 11:26:18 AM
Quote from: Sectomy on July 19, 2020, 10:48:40 AM
same here as Kiriakos,
same error message
2: Illegal string offset 'page_title'

any ideas ? :)

Did you try the solution offered earlier in the thread?

https://www.simplemachines.org/community/index.php?topic=559168.msg3968507#msg3968507
thx, i quoted it b4... Thank You !!!!