[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

[PHPBB] - New function inside session.php that redirect users have not filled required custom profiels.

Asked by stimart in phpBB

Tags: custom, profile, phpbb, db, database, sessio.php, session, pf_, php

Hi, :)

In the "session.php" I want to add a script (or a function) that checks if a user have NOT filled all "required custom profiles fields" and if so it redirect to control panel to force user to complete his profile.

I write this code and I put it inside session.php, but It doesn't work.

I need help!
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
function control_field()
  {
    global $phpbb_root_path, $phpEx;
 
			if (!defined('IN_ADMIN') && !defined('ADMIN_START') && !defined('IN_LOGIN') && $user->data['is_registered'])
			{
				if ($user->page['page_name'] != "ucp.$phpEx" || strpos($user->page['query_string'], 'mode=profile_info') === false)
				{
					if ($user->page['page_name'] != "posting.$phpEx" || (strpos($user->page['query_string'], 'mode=post') === false && strpos($user->page['query_string'], 'mode=reply') === false && strpos($user->page['query_string'], 'mode=edit') === false))
					{
           $sql = 'SELECT field_name
                FROM ' . PROFILE_FIELDS_TABLE . '
                WHERE field_active = 1
                    AND field_required = 1
                    AND field_show_profile = 1 AND user_id = ' . $user->data['user_id'];
            $result = $db->sql_query($sql);
            $db->sql_freeresult($result);
            while ($row = $db->sql_fetchrow($result))
            {
              $pf_name[] = 'pf_' . $row['field_name'];
            }
            for ($i = 0, $j = sizeof($pf_name); $i < $j; $i++)
            {
                if (!isset($user_fields['$pf_name[$i]']))
                {
                    $message = "Update your profile data";    
                    meta_refresh(3, append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile'));
                    trigger_error($message, E_USER_WARNING);
                }
            }
					}
				}
			}
  }
 
Related Solutions
Keywords: [PHPBB] - New function inside ses…
 
Loading Advertisement...
 
[+][-]03/09/09 04:15 PM, ID: 23842193Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/09/09 04:32 PM, ID: 23842304Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/09/09 04:34 PM, ID: 23842319Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/09/09 04:43 PM, ID: 23842389Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/10/09 03:36 AM, ID: 23844973Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_EXPERT_20070906