Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
I like to mail-out posts that I post in the Announcements section to all of my members, so that they don't forget about me. I was just thinking, whoah!, and thought it might be a nifty idea to just set everyone so that they're subscribed to my Announcements forum. This would go for current members (some kind of SQL command) and future members (new/different code in the registration process).

Would this be a good idea, or would users get sick of the E-mails? I don't add an announcement everyday. I have added 10 since the 24th of April. If I utilize this idea on my board, I was thinking I should include it in my How-To forum or possibly including it, along with other info and links to info in my How-To forum, in the registration E-mail and/or PM.

Would anyone know how to code this?

Sponsored Links
Joined: Jan 2003
Posts: 263
Member
Member
Joined: Jan 2003
Posts: 263
Definately a good idea!

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Well at least someone chimed in on it.

Anyone? Anyone? Bueller?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, that's a good idea. I'm a little swamped and don't have time to play with it right now, but you could certainly alter adduser.php to turn subscriptions for a certain forum on.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Yeah!!!

Sponsored Links
Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
For the mean-time. What would be the SQL command to set everyone to be subscribed to a specific forum?

Keyword: Announcements

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
*crickets chirping*

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
The subscriptions are set one at a time on a users preference. They are inserted into w3t_Subscribe. You could insert them by SQL QUERY one at a time. This might be a little time consuming though. Unless Josh writes up a magical script that will cycle through the users and insert them all.


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
yeah, I saw this and really don't have time to play right now - but you'd need a script to do the existing ones I think.

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
This isn't tested, but it should get you started. It should add all users as subscribers to the selected forum, starting with the next post.
Code
<br /><?<br />   $forum = "announce"; // Keyword of forum to add subscriptions to<br /><br />// Require the library<br />   require ("main.inc.php");<br /><br />// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate();<br />   $html = new html;<br /><br />// -----------------------------<br />// Make sure they should be here<br />   if ($user['U_Status'] != 'Administrator'){<br />      $html -> not_right ("You must be logged in, and be a valid administrator or moderator to access this.",$Cat);<br />   }<br /><br />// ------------------------<br />// Now show them their page <br />   $html -> send_header("Autosubscribe users",$Cat);<br /><br />   $query = "<br />    SELECT B_Number<br />    FROM {$config['tbprefix']}Posts<br />    WHERE B_Board = '$forum'<br />    ORDER BY B_Number DESC LIMIT 1<br />   ";<br />   $sth = $dbh -> do_query($query);<br />   list($Last) = $dbh -> fetch_array($sth);<br />   if ($Last < 1) { $Last = 1; }<br /><br />   $query = "<br />    SELECT U_Number, U_Username<br />    FROM {$config['tbprefix']}Users<br />    WHERE U_Number > 2<br />   ";<br />   $sth = $dbh -> do_query($query);<br />   while ($row = $dbh -> fetch_array($sth)) {<br />      list ($uid, $username) = $row;<br />      print "Adding user $username (#$uid)...<br />";<br />      $query = "<br />       INSERT INTO {$config['tbprefix']}Subscribe<br />       (S_Uid, S_Board, S_Last)<br />       VALUES ($uid, '$forum', $Last)<br />      ";<br />      $sth2 = $dbh -> do_query($query);<br />   }<br /><br />// ---------------<br />// Send the footer<br />   $html -> send_footer();<br />?><br />

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Save the file Gardener has above. It is tested by me and works fine. Just add the keyword where he states and it will add all users who ever posted in that forum into subscriptions.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
So in order for it to subscribe a user to say, the Announcements forum, they have to first post to the announcements forum?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
No, it should add all users except the place holder user and the superadmin (user #2).

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Yeah!! Thanks bunches Gardener!!!

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Let me know if it works OK and I'll release it in the mod forum.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
I just ran it, and checked out a few of my members' profiles, and they were all subscribed to it. It's a go!!! Thanks again!!! Now only if beta 4 hadn't broken my e-mail......

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Gardener it works I tested it on my test forum and posted above that it worked

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Oh, yeah, I forgot about that. I've got a splitting headache, I'll have to blame it on that. Should probably go to bed really.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
I think it is that time lag from Sweden to here

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Was this released as a mod? Great idea


Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 3273
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 20
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
isaac 2
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)