News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Custom Profile Field Mod

Started by winrules, March 30, 2006, 02:21:25 PM

Previous topic - Next topic

winterlok

Yeah it works on the default theme. Blah, I am so new, this is gonna be quite the messy adventure. If anyone reads this while I'm looking to figure out how to install it manually. If you know how, please PM me!

mediainvita.de

Quote from: mediainvita.de on February 17, 2007, 10:30:41 AM
hi

First things first: Thumbs up! Great Mod :-)

Anyway it misses a feature i really would like to see. I could program it myself, but i need some information first...

How could i realize a multiple selection Box with different ( alphabetically sorted ) Options.

I need it to realize something like a "my offer" selection. Admin offers some options and the user can select several points from the list. ( Normal users are shopowners which offer a wide variety of goods, which need to be selectable )

Any Idea?
 

Hmm...anyone an idea? I still dont know how to realize it? Where is the data stored in the db?

winterlok

Okay I am manually installing this, and I'd like to say it's going great (and it was for a time) but now its starting to suck a bit.

In the picture below you'll notice that the options aren't one under the other, and I can't figure out where in the coding I messed that up.





Also the coding below doesn't match up to either of the files they're supposed to correspond to. If anyone can help me with that, that would be great.

<file name="$themedir/Display.template.php">


<operation>
<search position="replace"><![CDATA[
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';
]]></search>
<add><![CDATA[
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" border="0" />' : $message['member']['online']['label'], '</a>';
DisplayFieldPostsPictures();
]]></add>
</operation>


<operation>
<search position="replace"><![CDATA[
// Show how many posts they have made.
]]></search>
<add><![CDATA[
global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

// Show how many posts they have made.
]]></add>
</operation>

</file>














<file name="$themedir/PersonalMessage.template.php">

<operation>
<search position="replace"><![CDATA[
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" />' : $message['member']['online']['label'], '</a>';
]]></search>
<add><![CDATA[
<a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['label'], '">', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . '.gif" alt="' . $message['member']['online']['label'] . '" />' : $message['member']['online']['label'], '</a>';
DisplayFieldPostsPictures();
]]></add>
</operation>









<operation>
<search position="replace"><![CDATA[
// Show how many posts they have made.
]]></search>
<add><![CDATA[
global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

// Show how many posts they have made.
]]></add>
</operation>

</file>

choloman05

#963
Does anyone have the version I can use w/smf 1.1.1 - or should this new version work w/1.1.1 ?  Thanks a lot.  

-nevermind guys. sorry bout this.

JamesWC

Quote from: JamesWC on February 18, 2007, 11:55:01 AMProblem solved, thanks a lot! :)

I think I spoke too soon, lol...

I can access the fields the way you described, drossman, but it seems I can't edit them this way. In my custom action, I have the following code:

global $sourcedir;

require($sourcedir . '/Profile.php');

loadThemeOptions($context['user']['id']);

echo 'Before: ', $context['member']['options']['CP1'];

echo '<br />';

$context['member']['options']['CP1'] = '0';

echo 'After: ', $context['member']['options']['CP1'];


The output on the page is:

QuoteBefore: 2
After: 0

...which seems fine, until you refresh the page and get exactly the same output. The custom profile field is not saved as '0', it only changes for the purpose of loading this page - in reality it seems to remain as '2'. How can I make it save changes in the database?

naitram

using the info from the last page or 2 in this thread i have added the following to index.template.php


global $sourcedir;
require($sourcedir . '/Profile.php');
loadThemeOptions($context['user']['id']);

echo '<td>CP4 = ' . $context['member']['options']['CP4']. '</td>';

this now prints on all pages of the site but i get the following errors in the error log

8: Undefined index: 2
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2855


8: Undefined index: is_owner
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2848


2 is my user_id

URPG

The current version worked without any trouble for 1.1.2. + TinyPortal.

drossman

Quote from: naitram on February 19, 2007, 03:20:45 PM
using the info from the last page or 2 in this thread i have added the following to index.template.php


global $sourcedir;
require($sourcedir . '/Profile.php');
loadThemeOptions($context['user']['id']);

echo '<td>CP4 = ' . $context['member']['options']['CP4']. '</td>';

this now prints on all pages of the site but i get the following errors in the error log

8: Undefined index: 2
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2855


8: Undefined index: is_owner
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2848


2 is my user_id

naitram.  the example that i gave as for accessing a custom profile field inside of a custom action.  this code won;t work inside your templates.

drossman

Quote from: JamesWC on February 19, 2007, 06:36:44 AM
Quote from: JamesWC on February 18, 2007, 11:55:01 AMProblem solved, thanks a lot! :)

I think I spoke too soon, lol...

I can access the fields the way you described, drossman, but it seems I can't edit them this way. In my custom action, I have the following code:

global $sourcedir;

require($sourcedir . '/Profile.php');

loadThemeOptions($context['user']['id']);

echo 'Before: ', $context['member']['options']['CP1'];

echo '<br />';

$context['member']['options']['CP1'] = '0';

echo 'After: ', $context['member']['options']['CP1'];


The output on the page is:

QuoteBefore: 2
After: 0

...which seems fine, until you refresh the page and get exactly the same output. The custom profile field is not saved as '0', it only changes for the purpose of loading this page - in reality it seems to remain as '2'. How can I make it save changes in the database?

james, you have to update the database or the new value won;t be saved.

JamesWC

Quote from: drossman on February 21, 2007, 09:36:15 AMjames, you have to update the database or the new value won;t be saved.

I came to the same conclusion and have been trying to do this, with only moderate success so far. I actually just posted my "new" problem a few minutes ago here, as I felt it was no longer specifically related to custom profile fields but PHP/MySQL in general. Please take a look if you have a moment. :)

naitram

Quote from: drossman on February 21, 2007, 09:35:31 AM
Quote from: naitram on February 19, 2007, 03:20:45 PM
using the info from the last page or 2 in this thread i have added the following to index.template.php


global $sourcedir;
require($sourcedir . '/Profile.php');
loadThemeOptions($context['user']['id']);

echo '<td>CP4 = ' . $context['member']['options']['CP4']. '</td>';

this now prints on all pages of the site but i get the following errors in the error log

8: Undefined index: 2
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2855


8: Undefined index: is_owner
File: /home/.sites/28/site1/web/smf/Sources/Profile.php
Line: 2848


2 is my user_id

naitram.  the example that i gave as for accessing a custom profile field inside of a custom action.  this code won;t work inside your templates.



other then the undefined index errors in the log


this code in my index.template.php does work


                if($context['user']['is_logged']){
global $sourcedir;
require($sourcedir . '/Profile.php');
//print_r ($context['member']);
loadThemeOptions($context['user']['id']);
                if($context['member']['options']['CP4']){     
                list ($junk,$WGBASE)=explode("com",$context['member']['options']['CP4']);
                list ($WGLOC,$junk)=explode(".",$WGBASE);
                echo '<td class="catbg">
                .
                .
                .
                </td>';
                }
                else { echo '<td width="271" class="catbg"><center>place message here</center></td>';
                }
}



just the annoyance of the undefined inxex erors

Iggiecat

#971
Is there a way to generate a field with a link - that auto-links the visible one in the post bits?






naitram

can you give some more detail.....

what do you want to display and what do you want the link to be?

Iggiecat

#973
well the link would be to a hiscores list -

http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1= [nofollow]USERNAME

so whatever name they've entered into that field would automatically create a link to ^^ that abovce with thier name at "USERNAME" location


So if you followed the image - USERNAME would = LadyBostwick, and you'd see a link exactly like:

LadyBostwick [nofollow]



perplexed

did you try with just this?


before field
[url=http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user=]

and

[/url]
after field?



Iggiecat

#975
that doesn't quite work - because i'd need 3 field spaces - the name id wouldn't show up or it would be linked to no one, because the username has to be at the end of tghe link ..

[url=http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user=USERNAME????]
( field input )
[/url]




Inflame

Heya,

I think I don't understand this mod too well yet, since something is going wrong,

Members complained about the fact that they couldn't find any of the new profile fields,
I tried it out with my test account, and it indeed turned-out to not work.

Users can not see any of the custom profile fields,
I checked-out the permission area to see if they were not allowed, but I couldn't find anything there related to this mod.

Can someone please help out to fix this?

Thanks you

God bless

naitram

if you arent using the default theme, you will need to modify your current theme

perplexed

Quote from: Iggiecat on February 22, 2007, 12:50:56 AM
that doesn't quite work - because i'd need 3 field spaces - the name id wouldn't show up or it would be linked to no one, because the username has to be at the end of tghe link ..

[url=http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user=USERNAME????]
( field input )
[/url]



sorry I was hoping what you wanted would work like this, with the username at the end

[url=http://www.myspace.com/%1] in the before spot and [/url] after

Inflame

Quote from: naitram on February 23, 2007, 09:31:34 AM
if you arent using the default theme, you will need to modify your current theme

This does not cause the problem,

I check this in the default theme, and it did not work.


ANyone has a better suggestion?

Advertisement: