[Released] Use Custom Profile Fields anywhere

MODs and Styles for phpBB3.

To post your MOD or style, go to the STG MOD Manager
Forum rules
Go to http://startrekguide.com/mods to submit your MOD or style

[Released] Use Custom Profile Fields anywhere

Postby Gonculator » 03 Jan 2011, 19:25

MOD Title: Use Custom Profile Fields anywhere
MOD Author: King Rhyono
MOD Description: Allows the use of custom profile fields anywhere.

Format:
CUSTOM_(field identification)_VALUE
CUSTOM_(field name)_NAME
If there are spaces in your identification/name, remove them.

In: includes/functions.php

Find
Code: Select all
        'A_COOKIE_SETTINGS'        => addslashes('; path=' $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' '; domain=' $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' '; secure')),
    )); 



After, add
Code: Select all

    
// Begin CPFs Anywhere MOD - King Rhyono
    
$user_id $user->data['user_id'];
    
$sql 'SELECT * 
        FROM phpbb_profile_fields_data
        WHERE user_id ='
.$user_id;
    
$result $db->sql_query($sql);
    
$row $db->sql_fetchrow($result);
    if (!empty(
$row)) {
        foreach(
$row as $key => $field) {
            
$template->assign_vars(array("CUSTOM".str_replace(" """ltrim(strtoupper($key), "PF"))."_VALUE" => $row[$key]));
        }                
    }
    
$db->sql_freeresult($result);
    
$sql 'SELECT lang_name FROM phpbb_profile_lang';
    
$result $db->sql_query($sql);
    while(
$row $db->sql_fetchrow($result)){
        
$template->assign_vars(array("CUSTOM_".str_replace(" """strtoupper($row['lang_name']))."_NAME" => $row['lang_name']));
    }
    
$db->sql_freeresult($result);
    
// End CPFs Anywhere MOD
 

MOD Version: 1.0.00
MOD Status: Released

Tested on phpBB version: 3.0.8
Released: 03 Jan 2011

Installation Level: easy
Installation Time: ~ 2 Minutes

This is an automated message posted by STG’s MOD Manager version 0.2.0
Last edited by Gonculator on 03 Jan 2011, 20:10, edited 2 times in total.
Reason: MOD Updated
I am Gonculator, the STG Forum Robot -- Please do not PM me, I will not answer, but I will eat users who PM me. :twisted:
User avatar
Gonculator
Forum Robot
Forum Robot
 
Posts: 643
Joined: 16 Nov 2006, 21:52
Location: Forum Robot
Gender: Male




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: [Released] Use Custom Profile Fields anywhere

Postby duesmandella » 06 Jan 2011, 15:58

What do you mean display them anywheres? any pics or idea's?
duesmandella    
Supporter
Supporter
 
Posts: 97
Joined: 27 Sep 2009, 11:22
Gender: Male
phpBB Knowledge: 2

Re: [Released] Use Custom Profile Fields anywhere

Postby King Rhyono » 06 Jan 2011, 18:22

Displaying them anywhere has limited uses, using them anywhere is quite a bit more useful. You can fetch the name and/or value of any custom field. One person wanted to give his users the option to choose the logo they see. By making logo a select type and then using {CUSTOM_LOGO_VALUE} in place of a logo, it will dynamically change per user's preferences.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [Released] Use Custom Profile Fields anywhere

Postby duesmandella » 06 Jan 2011, 19:00

so if i wanted to do a mouseover on someones username, it could show up on the mouse over as their real name(custom profile field)
i dont know im confused lol
duesmandella    
Supporter
Supporter
 
Posts: 97
Joined: 27 Sep 2009, 11:22
Gender: Male
phpBB Knowledge: 2

Re: [Released] Use Custom Profile Fields anywhere

Postby King Rhyono » 06 Jan 2011, 19:33

In most places you'd want to do that (i.e. profile, topics, memberlist) you can already do that. If you don't understand the application of this, then you probably don't need it.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [Released] Use Custom Profile Fields anywhere

Postby duesmandella » 07 Jan 2011, 17:08

King Rhyono wrote:In most places you'd want to do that (i.e. profile, topics, memberlist) you can already do that. If you don't understand the application of this, then you probably don't need it.


You never need half these things going on, but if its cool and improves a forum, then its worth looking into
duesmandella    
Supporter
Supporter
 
Posts: 97
Joined: 27 Sep 2009, 11:22
Gender: Male
phpBB Knowledge: 2

Re: [Released] Use Custom Profile Fields anywhere

Postby Mess » 10 Jan 2011, 07:52

Neat, thanks. :)
Mess    
Supporter
Supporter
 
Posts: 42
Joined: 11 Sep 2009, 06:59
Gender: Male
phpBB Knowledge: 2

Re: [Released] Use Custom Profile Fields anywhere

Postby jdrechsler » 28 Jul 2011, 05:59

Isn't there a way to chose the table, instead of hard coding the table name like in the code above?
jdrechsler
Ensign
Ensign
 
Posts: 61
Joined: 27 Jun 2009, 15:42
Gender: Male
phpBB Knowledge: 4

Re: [Released] Use Custom Profile Fields anywhere

Postby King Rhyono » 30 Jul 2011, 01:18

This is a mod for custom profile fields. There is only one custom profile fields table. There isn't any good reason not to hard code it.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [Released] Use Custom Profile Fields anywhere

Postby Sniper_E » 30 Jul 2011, 07:30

May I add... custom profile fields are setup by default to show in the user profile, viewtopic and memberlist.
If you want custom profile fields to show up anywhere else, they have to be hard codded in somewhere.
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 7010
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Next

Return to phpBB3 Customizations

Who is online

Users browsing this forum: No registered users and 6 guests

cron