Welcome, Guest. Please Login or Register.
May 14, 2025, 03:30:36 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Requested: Three mods... « previous next »
Pages: [1] 2 Reply Ignore Print
Author Topic: Requested: Three mods...  (Read 5450 times)
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Requested: Three mods...
« on: July 27, 2003, 02:58:51 PM »
Reply with quote

Okay, I need to have the following three mods created, or pointed to where they currently exist.

1.  "View Newest Threads".  This will list all newest threads made since someone's last visit.  Standard 20 threads per page is preferred.

2.  "Disable viewing Avatars" on profile settings.

3.  "Turn off all signatures" on profile settings.

The last two are end user controlled, great for people on dialup connections, etc.
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #1 on: July 27, 2003, 05:18:03 PM »
Reply with quote

OK. Here goes nothing....

For the first one - why not just mod the recent posts page (i.e www.yourforum.com/index.php?action=recent )

Then to show 20 per page open up recent.php
find:
$display = 10;

and change it to 20 ;)

THEN - as it will only by default show one page you need to do a couple of other changes. Firstly find:
$display = 10;
(again)
and above it add:

global $start;
$start=decodeurl($start);


Next find:
   $request = mysql_query("
      SELECT ID_MSG
      FROM {$db_prefix}messages AS m
      WHERE 1
      ORDER BY posterTime DESC
      LIMIT 0, " . ($display * 4)) or database_error(__FILE__, __LINE__);


Change it to:

   $request = mysql_query("
      SELECT ID_MSG
      FROM {$db_prefix}messages AS m
      WHERE 1
      ORDER BY posterTime DESC
      LIMIT $start, " . ($display * 4)) or database_error(__FILE__, __LINE__);


(note the change was 0 -> $start)

Next search for:
echo '<font size="1"><a href="' . $cgi . '">' . $txt[236] . '</a> ' . $txt[237] . '<br /></font>';
and above it add something like:
$next=$start+$display;
$prev=$start-$display;
if($start>0)
echo ' <font size="1"><a href="' . $scripturl . '?action=recent;start=$prev">prev</a> | ';
echo ' <font size="1"><a href="' . $scripturl . '?action=recent;start=$next">next</a><br>';


Note I haven't done any checking to see if there are still more posts to come but I assume you have a busy forum and no-one is going to go through every single post on your board!

Anyway - as always I haven't tested this but hopefully it should work. Obviously you'll need to add a link to the page somewhere on your board :D (it's normally in the info center as default - just a bit of HTML'ing around)

Right - I'll move onto mods 2 and 3 next (hope you don't mind that I'm not making a boardmod file but I don't really have time - should be easy enough to make one from this if you need to)
Logged
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #2 on: July 27, 2003, 05:30:22 PM »
Reply with quote

For the second two I will do them both at once as they are very similar!!

Firstly, you need to add two columns to your member database so open up phpmyadmin (or whatever tool you use) and add a column called hidesigs and one called hideavs to the _members table. Both should be a tinyint (or whatever its called - long as its an int its not a big problem) and both should have a default value of 0.

Next, open up profile.php, search for:

   $request = mysql_query("
      SELECT passwd, realName, emailAddress, websiteTitle, websiteUrl, signature, posts, memberGroup, ICQ, AIM, YIM, gender, personalText, avatar, dateRegistered, location, birthdate, timeFormat, timeOffset, hideEmail, ID_MEMBER, usertitle, karmaBad, karmaGood, lngfile, MSN, secretQuestion, secretAnswer

add on the next line down (ie between this line and the FROM line)

,hideavs,hidesigs


Next search for (its just under the last bit):

   $memsettings = mysql_fetch_array($request);

and after it add:

$memsettings['hideavs'] = ($memsettings['hideavs'] == 1 ? ' checked' : '');
$memsettings['hidesigs'] = ($memsettings['hidesigs'] == 1 ? ' checked' : '');


Next search for:

<tr>
                        <td width="45%"><font size="2"><b>' . $txt[721] . '</b></font></td>
                        <td><input type="checkbox" name="hideemail"' . $memsettings['hideEmail'] . ' /></td>
                     </tr>';

Above it add:

<tr>
                        <td width="45%"><font size="2"><b>"Hide Signatures?"</b></font></td>
                        <td><input type="checkbox" name="hidesigs"' . $memsettings['hidesigs'] . ' /></td>
                     </tr>
<tr>
                        <td width="45%"><font size="2"><b>"Hide Avatars?"</b></font></td>
                        <td><input type="checkbox" name="hideavs"' . $memsettings['hideavs'] . ' /></td>
                     </tr>

(This is the edit box's in place and everything we need in the first part of the profile is done!!)

Now - search for:

      $hideEmail = 0;
      if (isset($member['hideemail']))
         $hideEmail = 1;


add after it:

      $hidesigs = 0;
      if (isset($member['hidesigs']))
         $hidesigs = 1;
      $hideavs = 0;
      if (isset($member['hideavs']))
         $hideavs = 1;


FINALLY (in this file!) search for:
         SET $queryPasswdPart $customTitlePart realName='$member[name]', emailAddress='$member[email]', websiteTitle='$member[websitetitle]', websiteUrl='$member[websiteurl]', signature='$member[signature]', posts=$member[settings6], memberGroup='$member[settings7]', ICQ='$member[icq]', MSN='$member[msn]', AIM='$member[aim]', YIM='$member[yim]', gender='$member[gender]', personalText='$member[usertext]', avatar='$member[userpic]', $member[dr]location='$member[location]', birthdate='$member[bday]', lngfile='$member[language]', " . ($username == $member['user'] ? "memberIP='$memIP', " : '') . "timeFormat='$member[usertimeformat]', timeOffset=$timeOffest, secretQuestion='$member[secretQuestion]', secretAnswer='$member[secretAnswer]', hideEmail=$hideEmail$karmaStr

and insert between the bottom of this and the line beginning WHERE:

,hidesigs=$hidesigs,hideavs=$hideavs


RIGHT! We are finally getting there. If you have made the relevant changes to the members table (ie the phpadmin bit) AND just done all the above correctly you should now find the option to show/hide avs and sigs in the profile menu and the options should save correctly/give no errors.

I'll continue the next half of this on the next reply: :D
Logged
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #3 on: July 27, 2003, 05:39:27 PM »
Reply with quote

OK. Now I'm going to assume that you are only worried about hiding the sigs/avatars in the message display window and not too bothered about instant messages etc.

Now open up display.php:

Find:
      if ($muserID != '-1')
      {
                  $userinfo .= '
                  ' . $star . '<br /><br />

Just above it add:
if($userprofile[$mname]['hideavs']==1)
$userprofile[$mname]['avatar']='';
if($userprofile[$mname]['hidesigs']==1)
$userprofile[$mname]['signature']='';


This is ALL that is required in this file (I believe)

That should be it I think!! If you find where the avatar would normally be looks kinda funny (bunched up) you may need to replace the line above saying:
$userprofile[$mname]['avatar']='';

with something more like:
$userprofile[$mname]['avatar']='<br><br>';

But I actually think it will be OK without it :D

Anyway - hope it works. Note where I've told you to search for long lines relating to mysql you may find you have slightly bigger lines if you ahve a heavily modded board - but you should be able to work out where you are supposed to add the stuff anyway.

Hope this is of some use to you - if you ahve any problems post them here and I'll try help you out - as always make a backup before you do any of this stuff and I guess I recommend putting the stuff I just wrote into a boardmod file so as to make it easier to reapply if you upgrade your forums some time in the near or far future! :)

Grudge
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Requested: Three mods...
« Reply #4 on: July 27, 2003, 06:08:22 PM »
Reply with quote

Well, those last two are available in the upcoming version... and the first one isn't *that* hard to do either way, although it's not yet in there...

Basically, you'd store the newest ID_MSG when they visit, and put the old on in the session.  Then, that is their "last visit".  You check off $_SESSION['ID_LATEST_MSG'] and it's pretty easy to get messages (and topics) since then.

-[Unknown]
Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Requested: Three mods...
« Reply #5 on: July 27, 2003, 08:26:20 PM »
Reply with quote

Okay, keep it simple, LOL!

What I want it to do is only display the threads that have had new posts since the last time they've visited/looked at the thread.  When they get done looking at said thread and refresh that list, the thread will "dissapear" off the list of newest threads, provided that there's no new posts.

I can create a separate page for this, not a problem, I would like to have it take on the whole feel of the forum, though, and if possible, integrate it within the forums themselves...

We can change 10 most recent posts, people don't care about that, they want it like I've indicated above.  ::chuckles::  Ever try to do your damnedest to satisfy over 300 women?  It ain't easy (GET YOUR MINDS OUT OF THE GUTTERS!  LOL).

The other two hacks, THANK YOU!  ::bows::
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #6 on: July 27, 2003, 09:21:24 PM »
Reply with quote

Doh! Can't believe I didn't read that properly!!

Assuming that you basically want it to list ALL unread threads accross the whole board in order of post recent first (ie every thread which would USUALLY be marked with "new" this is what I  would probably do. Keep it simple...

Firstly, open index.php and search for:

      'movethread2' => array("$sourcedir/MoveThread.php", 'MoveThread2'),


and add:

      'newposts' => array("$sourcedir/Recent.php", 'NewThreads'),


open up Recent.php find the function and search for the function called: function RecentPosts(). Copy this WHOLE function and paste it into this file and rename the copy to NewThreads().   (you did say simple :D)

What this means now is that if you were to type www.yoursite.com/index.php?action=newposts you would get the old recent posts screen :)

Now - as you said you wanted it simple I am going to make this VERY simple. Basically - everything I say from now is obviously in the new copied function. The only thing we should need to change in this new function is:
      $request = mysql_query("
         SELECT m.smiliesEnabled, m.posterTime, m.ID_MSG, m.subject, m.body, m.ID_TOPIC, t.ID_BOARD, b.name AS bname, c.name AS cname, t.numReplies, m.ID_MEMBER, m2.ID_MEMBER AS ID_FIRST_MEMBER, m.posterName, m2.posterName AS firstPosterName, IFNULL(mem.realName, m.posterName) AS posterDisplayName, IFNULL(mem2.realName, m2.posterName) AS firstPosterDisplayName
         FROM {$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}categories AS c
            LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER=m.ID_MEMBER)
            LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER=m2.ID_MEMBER)
         WHERE m.ID_MSG IN (" . implode(',', $messages) . ")
            AND m2.ID_MSG=t.ID_FIRST_MSG
            AND t.ID_TOPIC=m.ID_TOPIC
            AND b.ID_BOARD=t.ID_BOARD
            AND c.ID_CAT=b.ID_CAT
         AND (FIND_IN_SET('$settings[7]', c.memberGroups) != 0 OR c.memberGroups='' OR '$settings[7]'='Administrator' OR '$settings[7]'='Global Moderator')
         ORDER BY m.posterTime DESC
         LIMIT 0, $display") or database_error(__FILE__, __LINE__);


Basically - if we can select the posts differently then we get different posts in the recent posts styled screen. I'm no expert in sql so I've kinda been guessing this by looking as messageindex. Hopefully someone else can confirm if this is correct or not.

*** EDITED IN - NOTE EVERYTHING FROM HERE TO THE NEXT LINE OF CODE IS FOR REFERENCE ONLY SO YOU CAN SEE WHAT I AM THINKING/CHANGING!! ****

I think the two WHERE clauses that need to be added are:
WHERE timeRead>m.posterTime
(timeRead comes from:
IFNULL(lt.logTime, 0) AS isRead
where lt comes from log_topics which is joined using:
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC=t.ID_TOPIC AND lt.ID_MEMBER=$ID_MEMBER)

Note: I'm mainly writing down this bit for my benefit!!

The other thing that must be checked is:
WHERE loggedRead>m.posterTime
There loggedRead comes from:
IFNULL(lmr.logTime, 0) AS loggedRead
Which itself comes from log_mark_read which is joined using:

LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD=b.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)

****************************************
IF this is correct the new sql call in this new function would be:
      $request = mysql_query("
         SELECT m.smiliesEnabled, m.posterTime, m.ID_MSG, m.subject, m.body, m.ID_TOPIC, t.ID_BOARD, b.name AS bname, c.name AS cname, t.numReplies, m.ID_MEMBER, m2.ID_MEMBER AS ID_FIRST_MEMBER, m.posterName, m2.posterName AS firstPosterName, IFNULL(mem.realName, m.posterName) AS posterDisplayName, IFNULL(mem2.realName, m2.posterName) AS firstPosterDisplayName, IFNULL(lmr.logTime, 0) AS loggedRead,IFNULL(lt.logTime, 0) AS isRead
         FROM {$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}categories AS c
            LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER=m.ID_MEMBER)
            LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER=m2.ID_MEMBER)
            LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD=b.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)
            LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC=t.ID_TOPIC AND lt.ID_MEMBER=$ID_MEMBER)
         WHERE m.ID_MSG IN (" . implode(',', $messages) . ")
            AND m2.ID_MSG=t.ID_FIRST_MSG
            AND    timeRead>m.posterTime
            AND   
loggedRead>m.posterTime
            AND t.ID_TOPIC=m.ID_TOPIC
            AND b.ID_BOARD=t.ID_BOARD
            AND c.ID_CAT=b.ID_CAT
         AND (FIND_IN_SET('$settings[7]', c.memberGroups) != 0 OR c.memberGroups='' OR '$settings[7]'='Administrator' OR '$settings[7]'='Global Moderator')
         ORDER BY m.posterTime DESC
         LIMIT 0, $display") or database_error(__FILE__, __LINE__);


Now - I am quite unsure whether that call is correct so hopefully Unknown or otherwise could verify this for me.

Now all you need to do is firstly $ID_MEMBER needs to be added to the list of globals for this "new" function. Secondly - do ALL the other changes I recommended in my first post about this (about $start etc) to get the several pages thing going.

I know this is a highly simple idea to what you ask but it may work. It should basically be the recent posts page but with ONLY those posts that have had new replies which are still to be read. I would really appreciate it if someone who knows about sql could comment on the legality of my sql_query :D :D
« Last Edit: July 27, 2003, 09:23:12 PM by Grudge » Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Requested: Three mods...
« Reply #7 on: July 27, 2003, 10:13:38 PM »
Reply with quote

Fatal error: Call to undefined function: decodeurl() in /usr/home/*/*/forums/Sources/Recent.php on line 37

Where is decodeurl() being called from?
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #8 on: July 27, 2003, 11:01:47 PM »
Reply with quote

Oh sorry. It was in my original ideas for what to change. I said add:
global $start;
$start=decodeurl($start);

In reality you didn't need the second line IIRC. Just keep the global $start bit in and delete the decodeurl stuff :)
Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Requested: Three mods...
« Reply #9 on: July 27, 2003, 11:17:08 PM »
Reply with quote

Under your current coding, where you have "limit $start, " returns an error.

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' 100' at line 5
File: /usr/home/*/*/*/forums/Sources/Recent.php
Line: 43
Changing that to "LIMIT 25,$start" returns the following error...

Unknown column 'timeRead' in 'where clause'
File: /usr/home/douglas/subsites/fff/forums/Sources/Recent.php
Line: 69
Grudge, if you want to pick this up via MSN, AIM, ICQ or Yahoo, hit me up via PM's here with your IM name.  :)
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Requested: Three mods...
« Reply #10 on: July 27, 2003, 11:52:50 PM »
Reply with quote

You can't use AS whatever's in your WHERE clauses.... you have to do it over again.  I think it remembers the value... but the AS is only for returning the result.

-[Unknown]
Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Requested: Three mods...
« Reply #11 on: July 28, 2003, 12:15:02 AM »
Reply with quote

Okay, so what do I need to change, and where?
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #12 on: July 28, 2003, 09:53:00 AM »
Reply with quote

Douglas - I tell you what - I am going to write this up as a little mod now so I can test that it works and I'll post it in a little while - to save me saying "try this" "try that" continously while I try to figure it out :D

Logged
Grudge
Global Moderator
Full Member
*****
Posts: 178


Damn llama's don't like me :(

Re:Requested: Three mods...
« Reply #13 on: July 28, 2003, 11:23:07 AM »
Reply with quote

OK. First of all you need to install this mod may by me:
http://www.yabbse.org/community/index.php?thread=25004
This basically add's a statistic that allows the board to track when somone last logged out (manually or automatically) It has some other stuff on it that displays on the board index but you can just remove those bits from the mod file if you don't want them

Now download this php file I made and put it in your sources directory: (rename from txt to php)
www.p0stwh0res.com/bins/newtopic.txt

Finally - in index.php above:
      'editpoll2' => array("$sourcedir/Poll.php", 'EditPoll2'),
add:
      'newposts' => array("$sourcedir/newtopic.php", 'NewPosts'),

Now if you type www.yoursite.com/index.php?action=newposts it will display all the threads created since you last logged out.

The only thing I would say is after installing the first mod you will probably find that it says that every thread is new because it will assume you have only just registered - that will sort itself out next time you login.

At the moment the list doesn't change if, for example, you read one of those newest threads. I could fairly easily change that so when you read a new thread it dissapears from the list (I believe).

I haven't been able to test this on a busy board so I'd be grateful if you could tell me if it works - it's still a rip off of recent.php but with a few changes. I'm very fairly on icq etc but if you want to take this to IM's from now on I check them fairly frequently :D

* Grudge prays this kinda works :)


Logged
Douglas
aka The Bear
Support Team
YaBB God
*****
Posts: 1050


Bears rule! Llamas rule too!

WWW
Re:Requested: Three mods...
« Reply #14 on: July 28, 2003, 02:17:17 PM »
Reply with quote

100839851, kind sir.  :)
Logged

Need help? Please SEARCH first.  No need for a bad attitude, we like helping positive minded people.
ComeHit.us Short URL  redirection svcs with YSE powered forums, COMING SOON!
Want to say thanks?  Check out http://comehit.us/?u=3
Pages: [1] 2 Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  Requested: Three mods... « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.035 seconds with 20 queries.