Advertisement:

Author Topic: Custom Profile Field Mod  (Read 950214 times)

Offline winterlok

  • Semi-Newbie
  • *
  • Posts: 15
Re: Custom Profile Field Mod
« Reply #960 on: February 18, 2007, 05:09:02 PM »
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!

Offline mediainvita.de

  • Newbie
  • *
  • Posts: 3
Re: Custom Profile Field Mod
« Reply #961 on: February 18, 2007, 06:31:18 PM »
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?

Offline winterlok

  • Semi-Newbie
  • *
  • Posts: 15
Re: Custom Profile Field Mod
« Reply #962 on: February 18, 2007, 07:26:55 PM »
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.

Code: [Select]
<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>

Offline choloman05

  • Full Member
  • ***
  • Posts: 620
  • Gender: Male
    • Competition Web Marketing
Re: Custom Profile Field Mod
« Reply #963 on: February 18, 2007, 09:33:38 PM »
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.
« Last Edit: February 18, 2007, 11:15:50 PM by choloman05 »

Offline JamesWC

  • Jr. Member
  • **
  • Posts: 158
Re: Custom Profile Field Mod
« Reply #964 on: February 19, 2007, 06:36:44 AM »
Problem 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:

Code: [Select]
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:

Quote
Before: 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?

Offline naitram

  • Jr. Member
  • **
  • Posts: 136
Re: Custom Profile Field Mod
« Reply #965 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

Offline URPG

  • Jr. Member
  • **
  • Posts: 360
Re: Custom Profile Field Mod
« Reply #966 on: February 21, 2007, 08:51:14 AM »
The current version worked without any trouble for 1.1.2. + TinyPortal.

Offline drossman

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom Profile Field Mod
« Reply #967 on: February 21, 2007, 09:35:31 AM »
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.

Offline drossman

  • Semi-Newbie
  • *
  • Posts: 27
Re: Custom Profile Field Mod
« Reply #968 on: February 21, 2007, 09:36:15 AM »
Problem 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:

Code: [Select]
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:

Quote
Before: 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.

Offline JamesWC

  • Jr. Member
  • **
  • Posts: 158
Re: Custom Profile Field Mod
« Reply #969 on: February 21, 2007, 09:43:51 AM »
james, 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. :)

Offline naitram

  • Jr. Member
  • **
  • Posts: 136
Re: Custom Profile Field Mod
« Reply #970 on: February 21, 2007, 10:04:11 AM »
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

Code: [Select]
                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

Offline Iggiecat

  • Semi-Newbie
  • *
  • Posts: 15
    • Zen
Re: Custom Profile Field Mod
« Reply #971 on: February 21, 2007, 12:30:48 PM »
Is there a way to generate a field with a link - that auto-links the visible one in the post bits?



 
« Last Edit: February 21, 2007, 12:41:36 PM by Iggiecat »


Offline naitram

  • Jr. Member
  • **
  • Posts: 136
Re: Custom Profile Field Mod
« Reply #972 on: February 21, 2007, 12:59:46 PM »
can you give some more detail.....

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

Offline Iggiecat

  • Semi-Newbie
  • *
  • Posts: 15
    • Zen
Re: Custom Profile Field Mod
« Reply #973 on: February 21, 2007, 01:02:54 PM »
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]
 
« Last Edit: February 21, 2007, 01:06:13 PM by Iggiecat »


Offline perplexed

  • SMF Hero
  • ******
  • Posts: 2,603
  • It's quite perplexing isn't it
Re: Custom Profile Field Mod
« Reply #974 on: February 21, 2007, 09:25:39 PM »
did you try with just this?

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

and

[/url]
after field?


Offline Iggiecat

  • Semi-Newbie
  • *
  • Posts: 15
    • Zen
Re: Custom Profile Field Mod
« Reply #975 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 ..

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

« Last Edit: February 22, 2007, 01:02:20 AM by Iggiecat »


Inflame

  • Guest
Re: Custom Profile Field Mod
« Reply #976 on: February 23, 2007, 09:26:21 AM »
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

Offline naitram

  • Jr. Member
  • **
  • Posts: 136
Re: Custom Profile Field Mod
« Reply #977 on: February 23, 2007, 09:31:34 AM »
if you arent using the default theme, you will need to modify your current theme

Offline perplexed

  • SMF Hero
  • ******
  • Posts: 2,603
  • It's quite perplexing isn't it
Re: Custom Profile Field Mod
« Reply #978 on: February 23, 2007, 12:42:01 PM »
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 ..

Code: [Select]
[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

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

Inflame

  • Guest
Re: Custom Profile Field Mod
« Reply #979 on: February 23, 2007, 03:40:30 PM »
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?