andreaconsole

Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

Activity

  • Thank you very much for your effort in your answer! It's not a piece of cake but I think I can do it. At the benigging I tried to simply extend the view, as you suggest, but I did't succeed in making my additional field sticky. May be I'll be more... view reply
  • Thanks! I tried something like what you say, but I didn't succeed... Can you give me a hint? I think I have to work on my register.php: I tried the modification highlighted below, but I'm not sure about what I'm... view reply
  • andreaconsole has a new avatar
    andreaconsole
  • I modified the registration form by: 1 - overriding the default registration form in order to eliminate "name" field and add "something about you" field 2 - overriding the default register action in order to set $name = $username Now, I don't...
    • I think there's no need to override the register view/ form at all. Instead you could extend the view to add your "about me" input field. As I understand you only want to use this field for account verification purposes (with uservalidationbyadmin plugin) but not add a profile field that shows this info on the profile pages. You can take a look at a plugin of mine (http://community.elgg.org/plugins/791444/1.1/elgg-1819-full-age-restriction-checkbox) that adds a checkbox to the register page. This is not exactly the same as you need but you will can see at least how to extend the register form and how to evaluate the input.

      The user input is evaluated in the function agerestriction_register_hook() in my plugin. In the same way you retrieve the "about me" input and save it for example as metadata:

      function about_me_user_input($hook, $type, $value, $params) {

          elgg_make_sticky_form('register');
          $user = elgg_extract('user', $params);

          if (!$user instanceof ElggUser) {
              return;
          }

          $about_me = get_input('about_me', false);

          if ($about_me) {

              $user->about_me = $about_me;

              return;

          }

          register_error(elgg_echo('error:no_about_me));

          forward(REFERER);

      }


      This function should be called by the 'action', 'register' plugin hook. Within the uservalidationbyadmin plugin the same plugin hook is used to manage the account validation / notify the admin. The notification is sent in the function uservalidationbyadmin_request_validation() that's in the lib/functions.php file. For the notification your can provide the text of the about_me input with $user->about_me. You only need to give the plugin hook function that retrieves the input in your plugin a higher priority (http://reference.elgg.org/elgglib_8php.html#a61ac4b86cafddcc201acda05a0e88997) to make sure it's executed before the plugin hook callback function in the uservalidationbyadmin plugin to be sure that the about_me input has already been retrieved and saved as metadata. The above code for the callback function might not be perfect yet. You might need to improve it to catch eventual misuse / faults of the users. For the rest that's necessary to extend the register page, you could take my plugin as a starting point and modify what's needed.

    • Thank you very much for your effort in your answer! It's not a piece of cake but I think I can do it.

      At the benigging I tried to simply extend the view, as you suggest, but I did't succeed in making my additional field sticky. May be I'll be more fortunate this time!

    • I just noticed that I have the register form included in the Age Restriction plugin that I linked above. This would override the original core from. I don't think that this is necessary, i.e. it should work (better) when not overriding the core register fom.

  • andreaconsole commented on the plugin Language Selector
    Great plugin: thank you!
  • andreaconsole replied on the discussion topic choosing site language AFTER logging in?
    I found that setting Minimum language completeness (e.g. 30) is mandatory. Now the plugin works perfectly! Thanks again. view reply
  • andreaconsole replied on the discussion topic choosing site language AFTER logging in?
    Just edited my answer before reading yours... As I said, nothing happens, and I don't have any strange plugin activated... view reply
  • andreaconsole replied on the discussion topic choosing site language AFTER logging in?
    Hi RvR thank you for the suggestion! I tried it, but I could not make it work: I switched off my theme and enabled the selector from plugin administration panel, but nothing happened to the header view reply