We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Trying to use user_edit_end hook to get posted form value

Development and Programming

Brad Morse's avatar
Brad Morse
428 posts
16 years ago
Brad Morse's avatar Brad Morse

I think I need to use this to accomplish the following http://www.solspace.com/docs/detail/user_user_edit_end/

I am using Solspace’s user module and I want to create a notification to the user when their member is moved from pending to another group.

I know the user module does that already, but it is a broad solution and I want some more customization than that.

What I want to do is:

I am creating a mini Control panel, so the admin I assign to this mini cp can update the pending member’s to their appropriate groups. Once the user is assigned to anything other than pending, then send an email to that user saying they are now approved.

The form is setup as

{exp:user:edit 
  form:id="member_form"
  form:class="register-alumni"
  member_id="{segment_3}" 
  allowed_groups = "4|24|23"
}
  <h3>{screen_name}</h3>
  Select graduation year to confirm their account: 
  <select name="group_id">
  {exp:query sql="SELECT group_id AS gid, group_title FROM exp_member_groups WHERE group_id = '4' OR group_id ='24' or group_id = '23'"}
    <option value="{gid}" {if group_id == gid}selected="selected"{/if}>{group_title}</option>
  {/exp:query}
  </select>
  
    <input type="submit" value="submit" name="submit"></p>
{/exp:user:edit}

I tried doing this

<?php $_GET['group_id']; ?>

but the security settings unset data, so I can not get the data from get/post, so that is where I think I will need to use this hook http://www.solspace.com/docs/detail/user_user_edit_end/

I have never used a hook before and I tried creating my own extension. I am lost on how I would use the hook with the extension as well as getting the data from the hook to use for my conditional and processing the email notification function.

I read this http://expressionengine.com/docs/development/extensions.html and I feel I am missing the part about how to obtain the data from that hook.

Any help is appreciated.

This is for v1.6.8

       
Kevin Gerich's avatar
Kevin Gerich
213 posts
16 years ago
Kevin Gerich's avatar Kevin Gerich

You could set your form redirect with the user being edited id in it,
Process and pull data, send email, on that template, then redirect, back to wherever you need to go.

Gets the job done, though not necessarily elegant.

Jim

       
Brad Morse's avatar
Brad Morse
428 posts
16 years ago
Brad Morse's avatar Brad Morse

So in the return=”” parameter of the user:edit form, I should set it to be

return="/{segment_1}/page-to-redirect-to/member_id"

And w/i the template “page-to-redirect-to”, have the code to grab the data and run it thru the php function?

       
Kevin Gerich's avatar
Kevin Gerich
213 posts
16 years ago
Kevin Gerich's avatar Kevin Gerich

Basically, that’s it. You can use all the available classes in the template, $DB, $INS, $EMAIL…… Just process data there then redirect back to a display page.

Jim

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.