Force Flag on Register

Support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
Forum rules
Please only request support for mods released by phpbbmodders.net found at either https://github.com/phpbbmodders/ or the MODDB at http://www.phpbb.com
User avatar
Ooopsie
Supporter
Supporter
Posts: 1213
Joined: 19 Aug 2010, 16:34
Location: Index, WA
Contact:

Force Flag on Register

Post by Ooopsie »

Rich,
Is it a big hassle for the Flags Mod, to add a force to choose flag on registration? If it can be done easily and you know how, I will switch from the one I am using as I know the support is bar-none.
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Force Flag on Register

Post by RMcGirr83 »

OPEN

language/en/ucp.php

Find This may be a partial find and not the whole line

Code: Select all

   'VC_REFRESH_EXPLAIN'      => 'If you cannot read the code you can request a new one by clicking the button.',



Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

// BEGIN National Flags
   'CHOOSE_FLAG'            => 'Please choose a National Flag',
// END National Flags


OPEN

includes/ucp/ucp_register.php


Find This may be a partial find and not the whole line

Code: Select all

      include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);


Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

      //Begin: National_Flag
      include($phpbb_root_path . 'includes/functions_flag.' . $phpEx);
      //End: National_Flag


Find This may be a partial find and not the whole line

Code: Select all

      // Check and initialize some variables if needed
      if ($submit)


Add before Add these lines on a new blank line before the preceding line(s) to find

Code: Select all

//Begin: National_Flag
      if (!empty($config['allow_flags']))
      {               
         $data['flag'] = request_var('flag', 0);               
      }
//End: National_Flag   


Find This may be a partial find and not the whole line

Code: Select all

         if (!check_form_key('ucp_register'))


Add before Add these lines on a new blank line before the preceding line(s) to find

Code: Select all

//Begin: National_Flag
         if (!empty($config['allow_flags']))
         {
            $flag_error = validate_data($data, array('flag'   => array('num', false, 1, 300)));
            if ($flag_error)
            {
               $error[] = $user->lang['CHOOSE_FLAG'];
            }
         }
//End: National_Flag   


Find This may be a partial find and not the whole line

Code: Select all

               'user_inactive_time'   => $user_inactive_time,
            );


Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

            //Begin: National_Flag
            if (!empty($config['allow_flags']))
            {
               $user_row['user_flag'] = $data['flag'];
            }
            //End: National_Flag


Find This may be a partial find and not the whole line

Code: Select all

      $template->assign_vars(array(
         'ERROR'            => (sizeof($error)) ? implode('<br />', $error) : '',


Add before Add these lines on a new blank line before the preceding line(s) to find

Code: Select all

      //Begin: National_Flag
      if (!empty($config['allow_flags']))
      {
         global $cache;
         get_user_flag();
         $flags = $cache->get('_user_flags');
         $flag_name = '';
         if ($data['flag'] && $config['flag_type'] != USER_FLAG_TEXT)
         {
            $flag_name = $flags[$data['flag']]['flag_image'];
         }
         unset($flags);            
         $s_flag_options = list_all_flags($data['flag']);
         
         $template->assign_vars(array(
            'S_FLAG_OPTIONS'   => $s_flag_options,
            'S_FLAGS_ENABLED'   => true,
            'FLAG_IMAGE'      => ($flag_name) ? "{$phpbb_root_path}images/flags/$flag_name" : '',
            'FLAG_NAME'         => $flag_name,
            'AJAX_FLAG_INFO'   => append_sid("{$phpbb_root_path}ajax_user_flag.$phpEx", 'flag_id=FLAG_ID'),
         ));
      }
      //End: National_Flag


OPEN

styles/xxx/template/ucp_register.html


Find This may be a partial find and not the whole line

Code: Select all

   <dl>
      <dt><label for="tz">{L_TIMEZONE}:</label></dt>
      <dd><select name="tz" id="tz" tabindex="7" class="autowidth">{S_TZ_OPTIONS}</select></dd>
   </dl>   


Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

   <!-- INCLUDE ucp_user_flag.html -->   



Refresh the style in the ACP and that should do it.
User avatar
Ooopsie
Supporter
Supporter
Posts: 1213
Joined: 19 Aug 2010, 16:34
Location: Index, WA
Contact:

Re: Force Flag on Register

Post by Ooopsie »

Thanks Rich. I will be changing....I'll uninstall the other flag mod and use yours.

Gras....
User avatar
Ooopsie
Supporter
Supporter
Posts: 1213
Joined: 19 Aug 2010, 16:34
Location: Index, WA
Contact:

Re: Force Flag on Register

Post by Ooopsie »

Worked great. Uninstalled the "other" flags program, installed via (AUTOMOD which I don't normally use), and made the above changes also. Worked first time through.

Had to do a FORCE install for the Flags as my edits in viewtop_body.html were a little out of the ordinary. Did a manual edit and it was done.

Many thanks Rich. All is well in Ooopsieville.
apestuff
New member
New member
Posts: 28
Joined: 24 Apr 2011, 17:23

Re: Force Flag on Register

Post by apestuff »

thanks, installed the flags module earlier, went smooth as silk, just as all the mods I have done from you, and was very happy to see this for registering, worked great, just as I expected
travis
New member
New member
Posts: 25
Joined: 03 Mar 2011, 12:07

Re: National Flag

Post by travis »

Hello Rich,

I have tried installing this Force flag on register mod. http://www.rmcgirr83.org/viewtopic.php?f=5&t=1286&hilit=flag
Now I got a problem. The Choose your country flag on registration page is now double. Please take a look. How do I fix this? TIA!

[img]http://lulzimg.com/i24/e7e2be.png[/img]
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: National Flag

Post by RMcGirr83 »

You have two of these in the ucp_register.html.

Code: Select all

   <!-- INCLUDE ucp_user_flag.html -->   


remove one of them and refresh the template in the ACP.
martin123456
Old member
Old member
Posts: 677
Joined: 30 Mar 2011, 00:32
Contact:

Re: Force Flag on Register

Post by martin123456 »

Works like a charm ty
PeanuT
Member
Member
Posts: 106
Joined: 05 Oct 2011, 17:38
Location: Stafforshire
Contact:

Re: Force Flag on Register

Post by PeanuT »

when i edited the language/en/ucp.php file i get a load of errors all over the site and don't let me log it
Website Founder of FearThePeanuts
Finger, My Arse! LoL Love The Royle Family
Image
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Force Flag on Register

Post by RMcGirr83 »

You probably edited the file with a non strict text editor, use Notepad++ to edit the file with and save it with encoding of UTF-8 without BOM.
PeanuT
Member
Member
Posts: 106
Joined: 05 Oct 2011, 17:38
Location: Stafforshire
Contact:

Re: Force Flag on Register

Post by PeanuT »

thanks rich that worked :)
Website Founder of FearThePeanuts
Finger, My Arse! LoL Love The Royle Family
Image
Purasevic
New member
New member
Posts: 1
Joined: 03 Nov 2011, 18:21

Re: Force Flag on Register

Post by Purasevic »

Problem with Breizh Ajax Checks
[img]http://content.screencast.com/users/DamirMitrovic/folders/Jing/media/9f1e0b2f-dade-4f81-87b5-ddd9b6c04477/2011-11-16_0222.png[/img]

how to get rid this problem?

Thanks
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Force Flag on Register

Post by RMcGirr83 »

There is no conflict as I have that mod installed on here as well as forcing to choose a national flag. Double check your edits to the files involved.
doktornotor
Member
Member
Posts: 98
Joined: 08 Nov 2011, 22:22
Contact:

Re: Force Flag on Register

Post by doktornotor »

Any hint on how to force this for current users when they edit their profile? ;)
Support requests via PM go straight to /dev/null!
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Force Flag on Register

Post by RMcGirr83 »

Open includes/ucp/ucp_profile.php

Delete Remove the preceding lines

Code: Select all

//Begin: National_Flag
               //Currently set to validate up to 300, if you want more
               //flags than 300 change to the amount you want
               if (!empty($config['allow_flags']))
               {
                  $validate_array = array_merge($validate_array, array(
                     'flag'         => array('num', true, 0, 300),
                  ));
               }
               //End: National_Flag


Find This may be a partial find and not the whole line

Code: Select all

$error = validate_data($data, $validate_array);


Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

               //Begin: National_Flag
               //Currently set to validate up to 300, if you want more
               //flags than 300 change to the amount you want
                if (!empty($config['allow_flags']))
                {
                  $flag_error = validate_data($data, array('flag'   => array('num', false, 1, 300)));
                  if ($flag_error)
                  {
                     $error[] = $user->lang['CHOOSE_FLAG'];
                  }
                }
               //End: National_Flag
Post Reply