Additional Settings For Custom Profile Fields [1.2]
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #61
RE: Additional Settings For Custom Profile Fields
(06-20-2012 08:05 AM)brad-t Wrote:  I am wondering if it's possible to do Avatar upload and Signature edit in this page as well
You can try this attachment (attached) in your test board. The avatar gallery is not included here.

This uses usercp_editsig, usercp_editsig_suspended, usercp_editsig_current and usercp_avatar templates. So you need to edit those templates.
This is for example only:
usercp_avatar:
Basically, you only need the input fields from this template.

HTML Code
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
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
	<tr>
		<td class="thead" colspan="2">
			<strong>{$lang->custom_avatar}</strong>
		</td>
	</tr>
	<tr>
		<td class="trow1" width="40%"><strong>{$lang->avatar_upload}</strong></td>
		<td class="trow1" width="60%">
			<input type="file" name="avatarupload" size="25" class="fileupload" />
			{$auto_resize}
		</td>
	</tr>
	<tr>
		<td class="trow2" width="40%"><strong>{$lang->avatar_url}</strong></td>
		<td class="trow2" width="60%"><input type="text" class="textbox" name="avatarurl" size="45" value="{$avatarurl}" /></td>
	</tr>
	<tr>
		<td class="trow1 smalltext" colspan="2">
			{$lang->avatar_note}{$avatarmsg}
			<div style="text-align:center">
				<label><input type="radio" class="radio" name="update_remove_avatar" value="0"{$urac[0]}>{$lang->leave_sig_settings}</label>
				<label><input type="radio" class="radio" name="update_remove_avatar" value="1"{$urac[1]}>{$lang->remove_avatar}</label>
				<label><input type="radio" class="radio" name="update_remove_avatar" value="2"{$urac[2]}>{$lang->change_avatar}</label>
			</div>
		</td>
	</tr>
</table>

There is an options to update and remove avatar (line #22 - #23), so the avatar process is not executed if the user choose the 'No action' option (by default, it's selected).

usercp_editsig:
The same as the avatar above, basically, you only need to input fields from this template.

HTML Code
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
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
	<tr>
		<td class="thead" colspan="2">
			<div class="float_right">
				<label><input type="checkbox" class="checkbox" name="updatesig" value="1"{$updatesigcheck} />&nbsp;{$lang->update_sig}</label>
			</div>
			<strong>{$lang->edit_sig}</strong>
		</td>
	</tr>
	<tr>
		<td class="trow1" valign="top" width="20%">
			<span class="smalltext">{$lang->edit_sig_note}</span>
			{$smilieinserter}
		</td>
		<td class="trow1" width="80%">
			<textarea rows="15" cols="70" id="signature" name="signature">{$sig}</textarea>
			{$codebuttons}
		</td>
	</tr>
	<tr>
		<td class="trow2">
			<span class="smalltext">{$lang->edit_sig_note2}</span>
		</td>
		<td class="trow2">
			<span class="smalltext">
				<label><input type="radio" class="radio" name="updateposts" value="enable" />&nbsp;{$lang->enable_sig_posts}</label><br />
				<label><input type="radio" class="radio" name="updateposts" value="disable" />&nbsp;{$lang->disable_sig_posts}</label><br />
				<label><input type="radio" class="radio" name="updateposts" value="0" checked="checked" />&nbsp;{$lang->leave_sig_settings}</label>
			</span>
		</td>
	</tr>
</table>

There is an additional checkbox for processing (validating and updating) the signature (line #5). If the user doesn't check the checkbox, the signature won't be saved (updated), but they can still view the change (a bit similar to preview).

usercp_editsig_current:
For the current/preview signature

HTML Code
1
2
3
4
5
6
7
8
9
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>{$lang->current_sig}</strong></td>
</tr>
<tr>
<td class="trow1">{$sigpreview}</td>
</tr>
</table>
<br />


usercp_editsig_suspended:
Will be displayed if the user doesn't have permission to edit their signature:

HTML Code
<div class="clear">{$lang->edit_sig_no_permission}</div>


There are some additional variables you need to add to your usercp template:
{$editsig}: for displaying the edit signature form or the no permission message.
{$signature}: for displaying the current/preview signature.
{$avatarupload}: for displaying the avatar form.
And you need to add enctype="multipart/form-data" to the form tags.

An example:

HTML Code
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<html>
<head>
<title>{$lang->user_cp}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="{$colspan}"><strong>{$lang->account_summary}</strong></td>
</tr>
<tr>
{$avatar}
<td class="trow2">
<span class="largetext">{$username}</span><br />
<strong>{$lang->postnum}</strong> <a href="search.php?action=finduser&amp;uid={$mybb->user['uid']}">{$mybb->user['posts']}</a> {$lang->posts_day}<br />
{$reputation}
<strong>{$lang->email}</strong> {$mybb->user['email']}<br />
<strong>{$lang->registration_date}</strong> {$regdate}<br />
<strong>{$lang->primary_usergroup}</strong> {$usergroup}<br />
{$referral_info}
</td>
</tr>
</table>
<br class="clear" />
{$errors}
<form action="usercp.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
	<div class="float_right" style="width:49%">
		<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
			<tr>
				<td class="thead" colspan="2"><strong>{$lang->edit_options}</strong></td>
			</tr>
			<tr>
				<td class="trow2">{$lang->tpp}</td>
				<td class="trow2">
					{$threadperpage}
				</td>
			</tr>
			<tr>
				<td class="trow2">{$lang->ppp}</td>
				<td class="trow2">
					{$postperpage}
				</td>
			</tr>
			<tr>
				<td class="trow2">Time Zone:</td>
				<td class="trow2">{$tzselect}</td>
			</tr>
			<tr>
				<td class="trow2" colspan="2">
					<div>{$showsig}</div>
					<div>{$showavatar}</div>
				</td>
			</tr>
			<tr>
				<td class="trow2" colspan="2">
					<div>{$allownotices}</div>
					<div>{$receivepms}</div>
					<div>{$pmnotice}</div>
					<div>{$pmnotify}</div>
				</td>
			</tr>
		</table>
	</div>
	<div style="width:49%">
		<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
			<tr>
				<td class="thead" colspan="4"><strong>{$lang->edit_profile}</strong></td>
			</tr>
			{$xtpf_minp['fid3']}
			<tr>
				<td class="trow2">{$lang->birthday}</td>
				<td class="trow2">
					{$birth_day}
				</td>
			</tr>
			<tr>
				<td class="trow2">{$lang->birthdayprivacy}</td>
				<td class="trow2">
					{$bdprivacy}
				</td>
			</tr>
			<tr>
				<td class="trow2" colspan="2">
					<table border="0" style="margin:auto">
						{$xtpf_minp['fid4']}
						{$xtpf_minp['fid5']}
						<tr>
							<td><img src="images/www.png" alt="" title="{$lang->website_url}" /></td>
							<td>
								{$userwebsite}
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		{$xtpf_minp['fid2']}{$xtpf_minp['fid6']}
	</div>
	<br />{$editsig}
	<br />
	{$signature}{$avatarupload}
	<br class="clear" />
	<div class="clear" style="text-align:center">
		<input type="hidden" name="action" value="do_update_xt_proffields" />
		<input type="submit" class="button" value="Update Profile" />
	</div>
</form>
<br class="clear" />
{$latest_subscribed}
{$latest_threads}
{$latest_warnings}
{$user_notepad}
</td>
</tr>
</table>
{$footer}
</body>
</html>



Attached File(s)
.php  xt_ucp_main.php (Size: 19.36 KB / Downloads: 437)

(This post was last modified: 08-26-2012 09:31 PM by RateU.)
06-23-2012 07:54 AM
Find all posts by this user Quote this message in a reply
brad-t Offline
Member
***
Posts: 120
Joined: Apr 2011
Post: #62
RE: Additional Settings For Custom Profile Fields
Thank you as always for your hard work!! I'm looking forward to try it out.
06-24-2012 02:47 AM
Find all posts by this user Quote this message in a reply
Gstone Offline
Member
***
Posts: 55
Joined: May 2012
Post: #63
RE: Additional Settings For Custom Profile Fields
I've been using this a bit and one of the things that I did was copy over some checkboxes from the options page to the User CP page. It seems to work fine when I click the update button in the User CP, but the checkboxes don't stay checked. If I go back to the options page, the correct ones are check.

Would you happen to know of a fix to keep the checkboxes properly saved in the User CP page?

By "checkboxes," I mean the options such as "Display users' avatars in their posts." etc.
07-24-2012 10:40 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #64
RE: Additional Settings For Custom Profile Fields
By default, this plugin doesn't touch any settings in Edit Options page. I don't know what method you use to update the user options from your User CP main page?

07-25-2012 03:40 AM
Find all posts by this user Quote this message in a reply
Gstone Offline
Member
***
Posts: 55
Joined: May 2012
Post: #65
RE: Additional Settings For Custom Profile Fields
I didn't really change anything - all I did was copy some code over from the edit options page, and the wrapped it in the form similar to this:

Code:
1
2
3
4
5
6
<form action="usercp.php" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
Contents and input fields
<input type="hidden" name="action" value="do_update_xt_proffields" />
<input type="submit" class="button" value="Update Profile" />
</form>


Which seems to work, except for what I said above about the checkboxes not displaying the correct selections (but the settings have been saved in Edit Options even after editing from User CP).

07-25-2012 08:22 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #66
RE: Additional Settings For Custom Profile Fields
Still, I don't know what your method to update the user's options.
What I mean is, I think you need php script to do that (by default, as far as I know, there is no do_update_xt_proffields action processed in usercp).

I don't know whether you use the example plugin in this post or not:
http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=1271&pid=1140
In the example plugin above, for example, if you want to display the Display users' avatars in their posts checkbox setting, you only need to put {$showavatar} variable in your main User CP page (the checked/unchecked status already included - I think).

I'm sorry if I misunderstand what you mean.

07-26-2012 04:21 AM
Find all posts by this user Quote this message in a reply
Gstone Offline
Member
***
Posts: 55
Joined: May 2012
Post: #67
RE: Additional Settings For Custom Profile Fields
sorry for not being more clear. Yes, I use that plugin along with the one in the first post to do this. I didn't know there was such a variable for the Options page checkboxes.
Thank you! That is what I am trying to do. I used the {$showavatar} and it's working perfectly. I also tested another one {$allownotices} and I think I get it now. I'll use this structure.

Smile

EDIT: The only one I cant find out is the daylight savings correction box. Would you know the variable for this or maybe if theres some way I could find out myself?
(This post was last modified: 07-26-2012 09:18 AM by Gstone.)
07-26-2012 09:01 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #68
RE: Additional Settings For Custom Profile Fields
Not all settings from the Edit Options page "loaded" by the plugin. Try re-downloading the plugin (I've updated it). Just replace the old one with the new one (you don't need to deactivate/reactivate it).

Use {$dstcorrection} variable for displaying the DST setting.
For example:

HTML Code
<tr>
	<td class="trow2">{$lang->dst_correction}</td>
	<td class="trow2">{$dstcorrection}</td>
</tr>


07-27-2012 02:54 AM
Find all posts by this user Quote this message in a reply
Gstone Offline
Member
***
Posts: 55
Joined: May 2012
Post: #69
RE: Additional Settings For Custom Profile Fields
Thank you very much RateU!
07-27-2012 07:59 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #70
RE: Additional Settings For Custom Profile Fields
Hallo, I have been working away using this on my new forum and I have a neat looking profile (I think) but I am struggling a little with the concepts of the inputs and so on to customize the usercp.php?action=profile page.

I really wanted to share this here as I think it is a neat little layout that uses only 5kb of javascript (not jquery) and has the option to enable tab persistence via a cookie. Unfortunately, I think that it would only really be good enough to share if the usercp.php?action=profile page was edited too.


Can you suggest what posts I should be looking at in this thread to work out how best to use the inputs? I did not really want to redo the whole usercp as one of our key things is getting users to use avatars from the avatar gallery, so having the avatar and sig on profile only helps me if the gallery is there too.

Thank you

(link to profile page)

http://www.classifiedbilliards.com/mybb/...http://www.classifiedbilliards.com/mybb/member.php?action=profi


[Image: leelink.gif]
MYBB1.6 & XThreads
08-07-2012 09:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: