latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Custom Profile Edit Form

Home Forums Community Forum Custom Profile Edit Form

This topic contains 6 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 3 months ago.

Topic Author Topic
Posted: Wednesday Sep 26th, 2012 at 11:36 am #26576

Hi,

I’m using the [s2Member-Profile /] shortcode for my profile edit form.

However, I need to modify the template (similarly to what I’ve done with the registration form). How can I do this without having to edit core files?

My progress so far is partly charted in this thread & this thread (sorry, wasn’t sure if I should post a new thread, but the title wasn’t relevant on my other one, so didn’t know if it’d get picked up!)

Thanks in advance for your help.
Sarah

List Of Topic Replies

Viewing 6 replies - 1 through 6 (of 6 total)
Author Replies
Author Replies
Posted: Wednesday Sep 26th, 2012 at 1:30 pm #26605
David Welch
Username: dwbiz05

Ok, so it looks like this form is created by a class function and not a template in s2member.

So, one option would be to copy the code BETWEEN:

<?php
/**
* Shortcode for `[s2Member-Profile /]` ( inner processing routines ).
*
* Copyright: © 2009-2011
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
* ( coded in the USA )
*
* Released under the terms of the GNU General Public License.
* You should have received a copy of the GNU General Public License,
* along with this software. In the main directory, see: /licensing/
* If not, see: {@link http://www.gnu.org/licenses/}.
*
* @package s2Member\Profiles
* @since 3.5
*/
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
	exit ("Do not access this file directly.");
/**/
if (!class_exists ("c_ws_plugin__s2member_sc_profile_in"))
	{
		/**
		* Shortcode for `[s2Member-Profile /]` ( inner processing routines ).
		*
		* @package s2Member\Profiles
		* @since 3.5
		*/
		class c_ws_plugin__s2member_sc_profile_in
			{
				/**
				* Handles the Shortcode for: `[s2Member-Profile /]`.
				*
				* @package s2Member\Profiles
				* @since 3.5
				*
				* @attaches-to ``add_shortcode("s2Member-Profile");``
				*
				* @param array $attr An array of Attributes.
				* @param str $content Content inside the Shortcode.
				* @param str $shortcode The actual Shortcode name itself.
				* @return str|null The resulting Profile Modifiation Form *( inline )*, or null if not logged-in.
				*/
				public static function sc_profile ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
				{
					eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
					do_action ("ws_plugin__s2member_before_sc_profile", get_defined_vars ());
					unset ($__refs, $__v); /* Unset defined __refs, __v. */

AND:

}
		}
	}
?>

in this file:

wp-content/plugins/s2member/includes/classes/sc-profile-in.inc.php

Then create your own function in wp-content/mu-plugins/s2-hacks.php (you may need to create this directory and file) like this:

<?php
add_action('ws_plugin__s2member_before_sc_profile','my_profile_form');

function my_profile_form(){
	//Copy the code mentioned above here and change it to look the way you want.
	//See example below:
	
	//leaving php
	?>
	<form action="" method="post">
	My Name: <input >
	</form>
	<?
	//back to php
	
	exit(); // this exit function keeps the rest of their code in that class from running.
}
?>

That should override their form with yours. Assuming you keep their functionality and stuff, I think it should still work fine.

Hope that helps.

Dave

PS. This is not perfect because it uses the exit() function which kills all the rest of the processing and could mess up other s2 functions being called at the same time.

  • This reply was modified 4 years, 3 months ago by  David Welch.
Posted: Thursday Sep 27th, 2012 at 5:51 am #26659

Thanks again David – appreciate your time. I’m a bit wary of potentially removing the rest of the form processing though – not just for now, but in case it causes issues later down the line with upgrades etc.

I’m starting to think I’m just going to have to use the default layout for both registration and profile edit (they need to be somewhat consistent I think). Not great, but I don’t see any ‘upgrade-proof’ way around it.

Given this, is there any way of changing the ‘Additional Info’ label (I know as a last resort I can resort to hiding via CSS). To my mind it seems that this label should be outside of

%%custom_fields%%

similarly to how the label for the initial registration fields can be modified separate from the fields themselves.

Getting every so slightly frustrated with this… I love what S2 does on the whole, but it seems like something pretty obvious has been missed here? (Or perhaps I’m just an extra demanding user!!!)

Posted: Thursday Sep 27th, 2012 at 10:40 pm #26782

is there any way of changing the ‘Additional Info’ label

You can try this hack in in the must-use plugins directory. Create this dir/file:

/wp-content/mu-plugins/s2hacks.php
[hilite pre_code]

[/hilite]

Posted: Friday Sep 28th, 2012 at 4:55 am #26811

Thanks Cristian, just tested & that works great to change the ‘Additional Info’ text.

Although I think I’m going to have to end up hiding it with CSS anyway, as I’m trying to get a consistent appearance for the registration & profile edit forms… and the ‘Additional Info’ header doesn’t appear on the latter!

Thanks though for the pointer… hopefully it might be helpful to someone else.

Posted: Friday Sep 28th, 2012 at 5:21 am #26816

Have looked into this a bit further, and wonder whether a custom profile edit page would be easier to achive with something like Gravity Forms.

According to this thread (member only access) on GF forums, this functionality is under development as part of their User Registration add-on. But…. no date!

On the same thread, someone has posted a customisation here: http://blog.fublo.net/2011/12/edit-wordpress-user-profiles-gravity-forms/. I’ve not tried it (& personally will probably stick to the default for now), but in case this helps anyone else…

Posted: Saturday Sep 29th, 2012 at 6:37 am #26924

Thanks Cristian, just tested & that works great to change the ‘Additional Info’ text.

Cool. :)

Thanks though for the pointer… hopefully it might be helpful to someone else.

You can also use it with other strings in s2Member that you may want to customize.

Viewing 6 replies - 1 through 6 (of 6 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.