[DEV] jQ User Map api3

Mod Support

Moderators: BNa, Sekuro, 4seven

[DEV] jQ User Map api3

Postby volksdevil » 08 Jul 2012, 20:18

With JQ User Map, how can we add members custom profile fields to display under the avatar when mouse hovered?
volksdevil

Tiptop

Tiptop
 
Posts: 29
Joined: 08 Jul 2012, 20:16
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby 4seven » 09 Jul 2012, 02:20

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
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby volksdevil » 09 Jul 2012, 14:45

8-)
volksdevil

Tiptop

Tiptop
 
Posts: 29
Joined: 08 Jul 2012, 20:16
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3 / Addition I v.0.0.1

Postby 4seven » 09 Jul 2012, 23:19

Load custom profile fields / Addition I v.0.0.1

open

user_weather/user_map.php

find

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


after add

Code: Select all
            // 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: Select all
, user_map_location, user_map_location_desc


find

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


after add

Code: Select all
            // 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: Select all
            '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: Select all
            //  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: Select all
<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: Select all
<!-- 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
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby volksdevil » 10 Jul 2012, 00:20

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?
volksdevil

Tiptop

Tiptop
 
Posts: 29
Joined: 08 Jul 2012, 20:16
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby 4seven » 10 Jul 2012, 00:33

php have more comfort as template switches

find

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


replace with

Code: Select all
            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
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby volksdevil » 10 Jul 2012, 00:59

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: Select all
            // 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
volksdevil

Tiptop

Tiptop
 
Posts: 29
Joined: 08 Jul 2012, 20:16
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby 4seven » 10 Jul 2012, 01:06

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
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080



Re: [DEV] jQ User Map api3

Postby 4seven » 10 Jul 2012, 01:13

volksdevil wrote:
Code: Select all
            // 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: Select all
// 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
User avatar
4seven

Tiptop

Tiptop
 
Posts: 318
Joined: 20 Jun 2012, 16:55
 
Resolution: 1920x1080


Re: [DEV] jQ User Map api3

Postby volksdevil » 10 Jul 2012, 01:22

: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.
volksdevil

Tiptop

Tiptop
 
Posts: 29
Joined: 08 Jul 2012, 20:16
 
Resolution: 1920x1080

Next

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 2 guests

cron