Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 15:39

All times are UTC + 1 hour




Post new topic Reply to topic  [ 69 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
 Post subject: [DEV] jQ User Map api3
PostPosted: 08 Jul 2012, 20:18 
Offline
Tiptop
Tiptop

Joined: 08 Jul 2012, 20:16
Posts: 29
With JQ User Map, how can we add members custom profile fields to display under the avatar when mouse hovered?


Top
 Profile  
Reply with quote  
PostPosted: 09 Jul 2012, 02:20 
Offline
Tiptop
Tiptop
User avatar

Joined: 20 Jun 2012, 16:55
Posts: 318
yeah, trigger_error told me that before.

here you can see the demo

http://4seven.bplaced.net/forum/1/user_weather/user_map.php

User 4seven and tester have filled out the test cpf's

After some further tests the instruction follows.

_________________
Current Mods | Mod Base | php(BB) programming | No help via PM


Top
 Profile  
Reply with quote  
PostPosted: 09 Jul 2012, 14:45 
Offline
Tiptop
Tiptop

Joined: 08 Jul 2012, 20:16
Posts: 29
8-)


Top
 Profile  
Reply with quote  
PostPosted: 09 Jul 2012, 23:19 
Offline
Tiptop
Tiptop
User avatar

Joined: 20 Jun 2012, 16:55
Posts: 318
Load custom profile fields / Addition I v.0.0.1

open

user_weather/user_map.php

find

Code:
    if (!function_exists('get_user_avatar'))
    {
    include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    }


after add

Code:
            // Load custom profile fields / Addition
            include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);    
            
            
// Grab all profile fields from users in id cache for later use
            $cp = new custom_profile();    
            $profile_fields_cache 
= $cp->generate_profile_fields_template('grab', $user_id_array);
            // Save from following SQL:  , user_map_location, user_map_location_desc
            // Load custom profile fields / Addition        


find and delete

Code:
, user_map_location, user_map_location_desc


find

Code:
        $row_username  = utf8_encode(urlencode($row['username']));


after add

Code:
            // Load custom profile fields / Addition
            $cp_row    = $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$row['user_id']]);
            $full_prof = '';
            for ($i = 0, $end = sizeof(@$cp_row['blockrow']); $i < $end; ++$i){
            $full_prof   .= '<strong>' . $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' . $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />';}
            // Load custom profile fields / Addition        


find

Code:
            'UM_LOCATION'      => ucwords(str_replace('_', ' ', $row['user_map_location'])),
            'UM_LOCATION_DESC' => ($row['user_map_location_desc'] !== 0) ? $row['user_map_location_desc'] : false


replace with

Code:
            //  Load custom profile fields / Addition            
            // 'UM_LOCATION'      => ucwords(str_replace('_', ' ', $row['user_map_location'])),
            // 'UM_LOCATION_DESC' => ($row['user_map_location_desc'] !== 0) ? $row['user_map_location_desc'] : false    
            //  Load custom profile fields
           'UM_CPF_SHOW'      =>  addslashes($full_prof)
            //  Load custom profile fields / Addition        


open

styles/prosilver/template/user_map.html

find

Code:
<br /><br />
{
L_U_M_LOC}:<br />
{
user_map.UM_LOCATION}
<!--
 IF user_map.UM_LOCATION_DESC -->
<
br /><br />
{
L_U_M_LOC_DESC}:<br />
{
user_map.UM_LOCATION_DESC}
<!--
 ENDIF -->


replace with

Code:
<!-- Load custom profile fields / Addition -->

<!--
<
br /><br />
{
L_U_M_LOC}:<br />
{
user_map.UM_LOCATION}
<
 !-- IF user_map.UM_LOCATION_DESC -- >
<
br /><br />
{
L_U_M_LOC_DESC}:<br />
{
user_map.UM_LOCATION_DESC}
<
 !-- ENDIF -- >
-->

<
br /><br />
{
user_map.UM_CPF_SHOW}

<!--
 Load custom profile fields / Addition -->


Note: This adds some more SQL to user_map.php

_________________
Current Mods | Mod Base | php(BB) programming | No help via PM


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 00:20 
Offline
Tiptop
Tiptop

Joined: 08 Jul 2012, 20:16
Posts: 29
Thanks 4seven,

Is it possible though to show cpf's individually? instead of all?

So I we can use things like:

{REAL_NAME} or {DRIVING} etc in the user map template?


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 00:33 
Offline
Tiptop
Tiptop
User avatar

Joined: 20 Jun 2012, 16:55
Posts: 318
php have more comfort as template switches

find

Code:
            $full_prof   .= '<strong>' . $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' . $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />'


replace with

Code:
            if (
                ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'A Test CPF')
            ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'B Test CPF')
         // ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'C Test CPF')
            ){
            
            $full_prof   
.= '<strong>' . $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' . $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />';
            
            



just enter the right Field Name. the above example shows the Field Names of the linked demo

_________________
Current Mods | Mod Base | php(BB) programming | No help via PM


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 00:59 
Offline
Tiptop
Tiptop

Joined: 08 Jul 2012, 20:16
Posts: 29
I'm just trying it now, but can't seem to get it to show two fields (Real name and Driving)

Here is the php
Code:
            // Load custom profile fields / Addition
            
$cp_row    $cp->generate_profile_fields_template('show'false$profile_fields_cache[$row['user_id']]);
            if (
                (
$cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Real name')
            ||  (
$cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Driving')
         
// ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'C Test CPF')
            
){
            
            
$full_prof   .= '<strong>' $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />';
            
            } 
            
// Load custom profile fields / Addition    


And page for test:
http://www.volksdevil.com/user_weather/user_map.php


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 01:06 
Offline
Tiptop
Tiptop
User avatar

Joined: 20 Jun 2012, 16:55
Posts: 318
The Field Name must be exactly as in acp settings. the code is tested.

the Field Name is what appears to the left in

Field Name: Field Value

http://4seven.bplaced.net/forum/1/user_weather/user_map.php

_________________
Current Mods | Mod Base | php(BB) programming | No help via PM


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 01:13 
Offline
Tiptop
Tiptop
User avatar

Joined: 20 Jun 2012, 16:55
Posts: 318
volksdevil wrote:
Code:
            // Load custom profile fields / Addition
            $cp_row    = $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$row['user_id']]);
            if (
                ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Real name')
            ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Driving')
         // ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'C Test CPF')
            ) {
            
            $full_prof   
.= '<strong>' . $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' . $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />';
            
            
} 
            
// Load custom profile fields / Addition          


the edit is false

this is right (as i mentioned above)

Code:
// Load custom profile fields / Addition
            $cp_row    = $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$row['user_id']]);
            $full_prof = '';
            for ($i = 0, $end = sizeof(@$cp_row['blockrow']); $i < $end; ++$i){
            if (
                ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Real name')
            ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'Driving')
         // ||  ($cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] == 'C Test CPF')
            ){

            $full_prof   .= '<strong>' . $cp_row['blockrow'][$i]["PROFILE_FIELD_NAME"] . ':</strong> ' . $cp_row['blockrow'][$i]["PROFILE_FIELD_VALUE"] . '<br /><br />';

            }

            }
            // Load custom profile fields / Addition     

_________________
Current Mods | Mod Base | php(BB) programming | No help via PM


Top
 Profile  
Reply with quote  
PostPosted: 10 Jul 2012, 01:22 
Offline
Tiptop
Tiptop

Joined: 08 Jul 2012, 20:16
Posts: 29
:D I'm not sure how I went wrong there but...

Thank you very much 4seven! That seems to work ok, I'll do some more testing.
Much appreciated. I think It's a great mod, and now with a great addition.

EDIT: Could we easily put user map location and user map description back into the template?
EDIT2: It's ok I worked it out :-D Thanks again 4seven.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 69 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.013s | 26 Queries | GZIP : Off ]