Redirect new users to a "Beginners Welcome" topic

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Ideas Centre
MarkTheDaemon
Former Team Member
Posts: 2770
Joined: Thu Oct 20, 2005 2:42 am
Location: United Kingdom
Name: Mark Barnes

Re: Redirect new users to a "Beginners Welcome" topic

Post by MarkTheDaemon »

Have taken your suggestion and packaged as another MOD, download Announcement Redirect on Login here.

Because it is using the same area in the code as the New User Redirect MOD if you have both the edits in the download will not be correct, they are for new installs only. To use both together you will need to ignore the edits for includes/functions.php and instead do the following:

FIND:

Code: Select all

			else
			{
				$redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
				$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
				$l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
			}
ADD, BEFORE:

Code: Select all

			else if (!empty($config['announce_redir_topic_id']) && $config['announce_redir_topic'] == true)
			{
				$sql = 'SELECT topic_id, topic_time
					FROM ' . TOPICS_TABLE . '
					WHERE topic_id = ' . $config['announce_redir_topic_id'];
				$result = $db->sql_query($sql);
				$row = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);
				
				if ($user->data['user_lastvisit'] < $row['topic_time'])
				{
					$redirect = "{$phpbb_root_path}viewtopic.$phpEx?t=" . $config['announce_redir_topic_id'];
					$message = ($l_success) ? $l_success : $user->lang['LOGIN_ANNOUNCE_REDIRECT_TOPIC'];
					$l_redirect = $user->lang['RETURN_ANNOUNCE_REDIRECT_TOPIC'];
				}
				else
				{
					$redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
					$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
					$l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
				}
			}
Any problems give me a shout.
BCFbuilderboy
Registered User
Posts: 35
Joined: Sat Nov 13, 2010 10:30 pm

Re: Redirect new users to a "Beginners Welcome" topic

Post by BCFbuilderboy »

Brilliant work mate, exactly what I wanted and works a treat. :D

you have created two great mods here which I'm sure will be of use to many forums...Thank you Mark
Locked

Return to “[3.0.x] MOD Requests”