What I would like to see is a modified announcement/article template that will allow only the main post and X amount of characters to be displayed for anyone who is not a registered account....
Something that will give people a "tease" of what they can get after they become a registered member.
I am sure this is just a modified piece of code that needs to be added to the showflat.php (or custom article.php) file... but my php skills are lacking in this area.
I think this would be an awesome hack for sites wanting more member registrations. I personally am sick of seeing, "currently there are 200 members and 450 unregistered users online"
Any input will be more than helpful and extremely appreciated
You have posted in the right place. I can assure you people do read these things. I can tell you that given time someone might look at this and write it up.
However if it is an urgency or something you might want to see in a week or two then you have two things you can do.
1. Write it yourself which you have already suggested you might do.
2. Or hire someone in our developer's for hire forum to write it for you.
If you choose to write it yourself if some hacks that might give you idea's on how to process will be JoshPet's Teaser Forum and Photopost's BodyTag Preview.
Thanks for your quick replies to this thread.... Im sorry if I came off in a bad way - it wasnt my intention. I just felt after reading about how a few owners wanted ways to encorage people to sign up for thier sites, that this would be a perfect solution (or alternative)
Im not usto posting on technical forums - Im usualy posting on forums about cars and such... so after reading technical forums for 5 years and now having this being only my 5 or so post, I fergot how some things take longer to receive replies to, than others....
You did not come off in any bad way at all. I hope you did not take my post in the wrong way. You posted twice in two days so I wanted to make sure you knew your options
I see Josh replied to this the same time I was writing my response before so cool deal.
Ok.... im working on this hack right now - its alot easier than I originaly thought it would be
Ill post up the changes when im done - it looks to only be a simple modification of...
Code
$postrow[$i]['BodyART'] = ($Body);
Code
$postrow[$i]['BodyART'] = substr($Body,0,200);
...in the showflat.php file
and changing the $body tag to $bodyART in your SHOWFLAT-ARTICLE.tmpl file(an add-on hack that can also be downloaded from ThreadsDEV - hack gives you anternative display for your tech articles)
now time to put in the if/then statements to ignore ADMIN/MOD/REG'd users and post a notice to all the unreged persons with a link to where they can register at. I might also add some intelegence so that it wont cut photos off in the middle of the URL, or text in the middle of a word
This is what I have, that Im currently playing off from...
Code
if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") || ($user['U_Status'] == "Users") ) { <br /> <br /> // Show Entire Message <br /> $postrow[$i]['BodyART'] = ($Body); <br /> // Show Only X Amount of Chrs <br /> } else { <br /> $postrow[$i]['BodyART'] = substr($Body,0,1000); <br /> $postrow[$i]['BodyART'] = $postrow[$i]['BodyART'] . "...<FONT COLOR=BLUE SIZE=2><B><I>MORE</I></B></FONT><BR><BR><FONT COLOR=RED SIZE=3><B>...To view the rest of this article, please <a href=http://www.celicahobby.com/ubbthreads/newuser.php><U>Register</U></a> for a new account.<BR> Or if you already have an account with us, <a href=http://www.celicahobby.com/ubbthreads/login.php><U>Login</U></a> now.</B></FONT>"; <br /> } <br />
The strip_tags function that you mentioned above is nice, but it also removes the line-feeds and any photos if there happens to be a photo in the first few X amount of characters.
I've also oppted to use the more direct approch to finding if a person is a member or just unregistered - this leave options open for me to ban someone from use of the articles/guides just by removing from the three main cats of Admin/Mod/User ... and put them into "Other" category
I havent put much time into it since my last post, but im sure that because this is such a simple modification, it shall be done very soon
BTW - we normaly get about 10 new members/day and since including this to the site, we've aquiered about 24 new members in just the past 6 hours!!! Can someone say PB&J TIME!
About 12 lines down, I added ",$btopic" to the string
to get...
Code
list ($Number,$Username,$Posted,$IP,$Subject,$Body,$File,$Open,$Approved,$Picture,$Reged,$Title,$Color,$Icon,$Poll,$ParentPost,$PostStatus,$Signature,$LastEdit,$LastEditBy,$Location,$TotalPosts,$Registered,$Rating,$Rates,$stars,$picwidth,$picheight,$usernum,$downloads,$anonname,$btopic) = $dbh -> fetch_array($sth);
Towards the end of SHOWFLAT.php, after
Code
$postrow[$i]['Body'] = $Body;
I added...
Code
if ($btopic) {<br /> if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") || ($user['U_Status'] == "Users") ) {<br /> // Show Entire Message<br /> $postrow[$i]['BodyART'] = ($Body);<br /> // Show Only X Amount of Characters<br /> } else {<br /> $postrow[$i]['BodyART'] = substr($Body,0,1000) . "<img src=\"http://www.celicahobby.com/ubb/blank.gif\">...<FONT COLOR=BLUE SIZE=2><B><I>MORE</I></B></FONT><BR><BR><TABLE WIDTH=98%><TR><TD><CENTER><FONT COLOR=RED SIZE=3><B>...To view the rest of this article, please <a href=http://www.celicahobby.com/ubbthreads/newuser.php><U>Register</U></a> for a new account.<BR> Or if you already have an account with us, <a href=http://www.celicahobby.com/ubbthreads/login.php><U>Login</U></a> now.</B></FONT></CENTER></TD></TR></TABLE>";<br /> }<br /> } else {<br /> $postrow[$i]['BodyART'] = ($Body);<br /> }<br />
I used "1000" as a decent amount of text that we can show, without giving away everything for free
I also added the "blank.gif" image to the line because sometimes the texts gets truncated in the middle of an image - by adding a second image to the line, it seems to have fixed a "problem" and displays correctly across mozilla & iExplorer just fine. (blank.gif is the same thing as spacer.gif, which can be found in the images directory of your threads install... blank/spacer.gif is basically a 1x1 invisible background image - it does nothing unless you specify a length and width.... so for my purposes, it does nothing except solve a broken image issue from a url that might get truncated)
The "Login/Register" text was put into it's own table so that I could get it centered without it messing with tables already in action (the truncated text might have lost a "table end" tag someplace - I prefer to not mess with that and just create my own tables )
And since i was feeling lazy - I didn't feel like searching for a php tag for the site root. So i just entered what I knew was correct - replace your site URL where mine is at.
in SHOWFLAT-ARTICLE.tmpl, i replace the $body tag with $bodyART
This is a great tool for sites that use a lot of articles, but how about limiting unregistered users to only see a certain amount of replies in a thread? The last post could be a post from admin explaining that there are more replies but you must be registered and logged-in to read them.
Where does the second "else" come in? It looks to see if you're an admin, mod, or user and if you are it serves the reply. Else, it gives the register text. What is the next "else" for? Also, does this replace each and every reply with the register text for guests, or just the first reply?
$btopic = TOPIC (btopic is 1 or TRUE in the DB) and !$btopic = ALL REPLIES (btopic is 0 or FALSE in the DB)
The first IF statement just tells the difference between a TOPIC or a REPLY
The second IF statement tells it to display a full post if you are Admin/Mod/User and will only display a message if you are anything else (truncated TOPIC + message if its the TOPIC.... and message only, if its a reply)
the whole IF statement is just testing if the post is a TOPIC or REPLY and then dealing with it acordingly
...this is why you can get two different NOTICES TOPIC NOTICE = truncate and display, "there is more text, register if you want to read it" REPLY NOTICE = "you cannot read this reply until your are registered" (to be blunt )
if you are not using articles, just replace "$postrow[$i]['Body'] = ($Body);" with the two larger code snippets i've written above
both code snippets are different... the first one handles TOPICS and the second one does REPLIES
Check - "if (!$btopic)" to see the main difference ( ! = NOT.... meaning, NOT TOPIC... aka, is REPLY)
Sorry, Im sure you deal with ALOT of kids on your site and need to explain things in detail - please do not mistake my detail as talking down to you, because it is in no way is that my intention - I too deal with alot of people on my site that requier detailed answers - so It just comes naturaly for me to try to cover all the details in one reply
<br />$postrow[$i]['Body'] = "...To view this comment/reply, please <a href=\"{$config['phpurl']}/newuser.php\" /><U>Register</U></a> for a new account.<BR> Or if you already have an account with us, <a href=\"{$config['phpurl']}/login.php\" /><U>Login</U></a> now.</B>";
And no offense taken. Details are good. I have put this up on my site for now so you can check it out if you want. Some people might prefer that there only be one reply that states there are X amount of replies to this post...to read them...bla bla bla. Of course, this probably requires some difficult coding.
I have added the ability to have it do this for select forums. Just replace A, B, and/or C with the keywords for the forums that you want to limit. You can use as many or as little as you like. Or, if you want to list the forums that you want it to NOT limit, replace == with !=.... I think.
Code
<br /> if ((!$btopic) && (($Board == 'A') || ($Board == 'B') || $Board == 'C'))) { <br /> if ( ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") || ($user['U_Status'] == "Users") ) { <br /> // Show Entire Message <br /> $postrow[$i]['Body'] = ($Body); <br /> // Replace replies with 'Please Register/Login' text <br /> } else { <br /> $postrow[$i]['Body'] = "To view this comment/reply, please <a href=\"{$config['phpurl']}/newuser.php\" /><U>Register</U></a> for a new account.<BR> Or if you already have an account with us, <a href=\"{$config['phpurl']}/login.php\" /><U>Login</U></a> now.</B>"; <br /> } <br /> } else { <br /> $postrow[$i]['Body'] = ($Body); <br /> } <br />
and then include "$Board == stristr(",{$config['articleboards']},", ",$Board,") instead of listing each board in the file - rather than having the edit the file each time you add new boards, just add the boards to your admin config options page
(my usage of "stristr" should be correct - if not, I think that "SUBST($config['articleboards'])" might also do the trick - i might be getting EXCEL and PHP commands mixed???)
There may be a slight misspelling in the mod code. My user group is 'User', not 'Users'. I am pretty sure this is the default. I was getting PMs left and right from users saying they were getting the register posts.
[]DLWebmaestro said: There may be a slight misspelling in the mod code. My user group is 'User', not 'Users'. I am pretty sure this is the default. I was getting PMs left and right from users saying they were getting the register posts. [/]
intresting.... because I got the exact same response from my users for the past few hours, as you had - but I looked in my DB and thought this was correct (I guess I should have looked at the actual code, rather than whats displayed in the DB .... this looks like a confusing bug from infopop in the 6.2x version of threads?)
Good find! - I just switched "Users" to "User" and things work like how they should!
yes - U_Groups and User U_Status are entirely different things. The status is used for access to admin/moderator only stuff... and groups are used for forum access.... read/write permissions and such.
[]JoshPet said: yes - U_Groups and User U_Status are entirely different things. The status is used for access to admin/moderator only stuff... and groups are used for forum access.... read/write permissions and such. [/]
does my statement of "my php skills are lacking" in the topic post, count as a disclaimer
No you are doing great! Really - this is the best way to learn. And I definately see your confusion there. But you have tackled and accomplished something cool. Next thing you know you'll be a major hacker here.
Just wondering if you have had time to write this up as a official mod??? I am VERY interested in getting this going on my site... I have tons of guest users, that I wish would register.
I tried to read through this thread, but seems a lot of hacking, and its a bit rough to follow.
Can we get a step by step mod done up? That would be awesome. You are right in your first post... There are a lot of users who would like this mod! Its exactly what I was looking for.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.