php forum
php mysql forum
php mysql smarty
 
Page 1 of 3 1 2 3 >
Topic Options
#255730 - 08/04/03 04:07 AM Unregistered users only see first post and X amount of letters/chrs
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
Here is what I currently have... <br />http://www.everythingcelica.com/installs/index.shtml <br /> <br />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.... <br /> <br />Something that will give people a "tease" of what they can get after they become a registered member. <br /> <br />I am sure this is just a modified piece of code that needs to be added to the shotflat.php (or custom article.php) file... but my php skills are lacking in this area. <br /> <br />I think this would be an awesome hack for sites wanting more member registrations. I personaly am sick of seeing, "currently there are 200 members and 450 unregistered users online" <br /> <br />Any input will be more than helpfull and extremely apreciated []http://www.everythingcelica.com/ubbthreads/images/graemlins/thumbsup.gif[/] thank you!

Top
#255731 - 08/06/03 03:15 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
i guess this isnt such a popular idea... ?<br /><br />i need to touch up my php skills and do it for myself if no one will take on this task for the group <img src="/forum/images/graemlins/crazy.gif" alt="" />

Top
#255732 - 08/06/03 03:31 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
This probably wouldn't bee too difficult.<br /><br />I'd tackle it, but I just have a full plate right now to tackle stuff for here. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />But if I find myself bored. .... <img src="/forum/images/graemlins/wink.gif" alt="" />
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#255733 - 08/06/03 03:36 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
ID242,<br /><br /> 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.<br /><br /> 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.<br /><br /> 1. Write it yourself which you have already suggested you might do. <br /><br /> 2. Or hire someone in our developer's for hire forum to <br /> write it for you.<br /><br /> 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.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#255734 - 08/06/03 03:47 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: sf49rminer]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
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)<br /><br />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....<br /><br />Im a n00b <br /><br />Thank you and best regards,<br />-isaac<br />

Top
#255735 - 08/06/03 04:26 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
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 <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />I see Josh replied to this the same time I was writing my response before so cool deal.<br /><br />
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#255736 - 08/06/03 07:13 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: sf49rminer]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
Ok.... im working on this hack right now - its alot easier than I originaly thought it would be <br /> <br />Ill post up the changes when im done - it looks to only be a simple modification of... <br /> <br />
Code:
$postrow[$i]['BodyART'] = ($Body);
<br /> <br />
Code:
$postrow[$i]['BodyART'] = substr($Body,0,200);
<br /> <br />...in the showflat.php file <br /> <br />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) <br /> <br />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 <img src="/forum/images/graemlins/smile.gif" alt="" /> <br />


Edited by id242 (08/06/03 07:19 PM)

Top
#255737 - 08/06/03 08:00 PM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
You got it. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />When you complete it, please write it up and post it here.<br /><br /><img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />To check if they are not logged in this will do the trick:<br /><br />if (!$user['U_Username']) {<br /> // Do the not logged in stuff<br />}<br /><br /><br />Also <br /><br />strip_tags($Body);<br /><br />is a simple tag that will strip the HTML stuff out (so a link or image doesn't break in the middle if it's gotten chopped of. :
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#255738 - 08/07/03 12:31 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: Daine]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
This is what I have, that Im currently playing off from... <br /> <br />
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'] . "...&lt;FONT COLOR=BLUE SIZE=2&gt;&lt;B&gt;&lt;I&gt;MORE&lt;/I&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT COLOR=RED SIZE=3&gt;&lt;B&gt;...To view the rest of this article, please &lt;a href=http://www.everythingcelica.com/ubbthreads/newuser.php&gt;&lt;U&gt;Register&lt;/U&gt;&lt;/a&gt; for a new account.&lt;BR&gt; Or if you already have an account with us, &lt;a href=http://www.everythingcelica.com/ubbthreads/login.php&gt;&lt;U&gt;Login&lt;/U&gt;&lt;/a&gt; now.&lt;/B&gt;&lt;/FONT&gt;"; <br />	} <br />
<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. <br /> <br />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 <br /> <br />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 <br /> <br />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! <img src="/forum/images/graemlins/smile.gif" alt="" />

Top
#255739 - 08/07/03 12:35 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
Yay! <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />Glad it's working for you. <img src="/forum/images/graemlins/smile.gif" alt="" />
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#255740 - 08/07/03 12:36 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
I just gotta fix it so that it hits only the first post in the topic and none of the replies <img src="/forum/images/graemlins/smile.gif" alt="" /> also an option to show or not to show replies.<br /><br />then to put the "show X chars" and "show entire thread or only first post" into the admin modification variables box

Top
#255741 - 08/07/03 05:01 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
There you go. Thats why I suggested the Body Tag Preview Hack. <img src="/forum/images/graemlins/wink.gif" alt="" /><br /><br />Glad you got that. <img src="/forum/images/graemlins/wink.gif" alt="" />
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#255742 - 08/07/03 08:06 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: sf49rminer]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
I’m pretty much through working on it... I've done what I feel needs to be done with it<br /><br />in SHOWFLAT.php, I added ",B_Topic" to the end.<br /><br />to get...<br />
Code:
SELECT t1.B_Number,t2.U_Username,t1.B_Posted,t1.B_IP,t1.B_Subject,t1.B_Body,t1.B_File,t1.B_Status,t1.B_Approved,t2.U_Picture,t1.B_Reged,t2.U_Title,t2.U_Color,t1.B_Icon,t1.B_Poll,t1.B_Parent,t2.U_Status,t2.U_Signature,t1.B_LastEdit,t1.B_LastEditBy,t2.U_Location,t2.U_TotalPosts,t2.U_Registered,t2.U_Rating,t2.U_Rates,t2.U_RealRating,t2.U_PicWidth,t2.U_PicHeight,t2.U_Number,t1.B_FileCounter,t1.B_AnonName,B_Topic<br />
<br /><br />About 12 lines down, I added ",$btopic" to the string<br /><br />to get...<br />
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 -&gt; fetch_array($sth);
<br /><br />Towards the end of SHOWFLAT.php, after<br />
Code:
$postrow[$i]['Body'] = $Body;
<br /><br />I added...<br />
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) . "&lt;img src=\"http://www.everythingcelica.com/ubb/blank.gif\"&gt;...&lt;FONT COLOR=BLUE SIZE=2&gt;&lt;B&gt;&lt;I&gt;MORE&lt;/I&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;TABLE WIDTH=98%&gt;&lt;TR&gt;&lt;TD&gt;&lt;CENTER&gt;&lt;FONT COLOR=RED SIZE=3&gt;&lt;B&gt;...To view the rest of this article, please &lt;a href=http://www.everythingcelica.com/ubbthreads/newuser.php&gt;&lt;U&gt;Register&lt;/U&gt;&lt;/a&gt; for a new account.&lt;BR&gt; Or if you already have an account with us, &lt;a href=http://www.everythingcelica.com/ubbthreads/login.php&gt;&lt;U&gt;Login&lt;/U&gt;&lt;/a&gt; now.&lt;/B&gt;&lt;/FONT&gt;&lt;/CENTER&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;";<br />		}<br />	} else {<br />	 $postrow[$i]['BodyART'] = ($Body);<br />	}<br />
<br />I used "1000" as a decent amount of text that we can show, without giving away everything for free <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />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)<br /><br />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 <img src="/forum/images/graemlins/laugh.gif" alt="" />)<br /><br />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.<br /><br />in SHOWFLAT-ARTICLE.tmpl, i replace the $body tag with $bodyART<br /><br />ARTICLE TEMPLATES can be found at...<br />http://www.ubbdev.com/forum/showflat.php?Number=79420<br />

Top
#255743 - 08/07/03 08:53 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
Great work with this Isaac! Great idea! <img src="/forum/images/graemlins/waytogo.gif" alt="" /> <br /> <br />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? <br />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.

Top
#255744 - 08/07/03 09:17 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: eslmix]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
DLWebmaestro, "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." <br /> <br />This is already a feature of whats currently posted - I've added this comment to the end of the main article where it gets truncated... <br /> <br />And to add a feature where replies do not get shown - you just need to create... <br /> <br />
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 />	     // Replace replies with 'Please Register/Login' text <br />		} else { <br />			 $postrow[$i]['BodyART'] = "...To view this comment/reply, please &lt;a href=http://www.everythingcelica.com/ubbthreads/newuser.php&gt;&lt;U&gt;Register&lt;/U&gt;&lt;/a&gt; for a new account.&lt;BR&gt; Or if you already have an account with us, &lt;a href=http://www.everythingcelica.com/ubbthreads/login.php&gt;&lt;U&gt;Login&lt;/U&gt;&lt;/a&gt; now.&lt;/B&gt;"; <br />		} <br />	} else { <br />	 $postrow[$i]['BodyART'] = ($Body); <br />	}
<br /> <br />and add this under the code i've mentioned above....

Top
#255745 - 08/07/03 09:28 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
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?<br /><br />

Top
#255746 - 08/07/03 09:33 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: eslmix]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
$btopic = TOPIC (btopic is 1 or TRUE in the DB) <br />and <br />!$btopic = ALL REPLIES (btopic is 0 or FALSE in the DB) <br /> <br />The first IF statement just tells the difference between a TOPIC or a REPLY <br /> <br />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)

Top
#255747 - 08/07/03 09:34 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: VickiSmith]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
Ah...wait..I kind of see it....<br /><br />IF<br />..IF A<br />....THEN A1<br />....ELSE A2<br />..ELSE B

Top
#255748 - 08/07/03 09:36 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: eslmix]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
Okay. So it's....<br /><br />IF (this is a reply)<br />..IF (member)<br />....THEN (show everything)<br />....ELSE (truncate)<br />..ELSE (show everything)<br /><br />Wow it's been a long time since I've flowcharted. <img src="/forum/images/graemlins/grin.gif" alt="" />

Top
#255749 - 08/07/03 09:39 AM Re: Unregistered users only see first post and X amount of letters/chrs [Re: eslmix]
id242_dup1 Offline
Member

Registered: 05/23/03
Posts: 159
Loc: Los Angeles
the whole IF statement is just testing if the post is a TOPIC or REPLY and then dealing with it acordingly <img src="/forum/images/graemlins/smile.gif" alt="" /> <br /> <br />...this is why you can get two different NOTICES <br />TOPIC NOTICE = truncate and display, "there is more text, register if you want to read it" <br />REPLY NOTICE = "you cannot read this reply until your are registered" <br />(to be blunt <img src="/forum/images/graemlins/tongue.gif" alt="" />)

Top
Page 1 of 3 1 2 3 >



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks