Jump to content
InvisionCommunity.de - Der Deutsche Invision Community Support
Sign in to follow this  
TomCrow

Flag Mod - Anzeige im Profil statt Topic

Recommended Posts

Hallo!

Ich hab' bei invisionize folgenden mod gefunden: Flag Hack for IBF 1.3 by YBJS

Der mod legt ein custom profile field "Country" (dropdown) an, in der Topic.php werden dann folgende Änderungen durchgeführt:

..


STEP 4 - Modify Sources/Topics.php: (around Line 620):

------


Find:


  //--------------------------------------------

  // Optimized query?

  // mySQL.com insists that forcing LEFT JOIN or

  // STRAIGHT JOIN helps the query optimizer, so..

  //--------------------------------------------

        

  $DB->query( "SELECT p.*,

       m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts,m.aim_name,

.icq_number,

       m.signature, m.website,m.yahoo,m.integ_msg,m.title,m.hide_email,m.msnname, m.warn_level, m.warn_lastwarn,

       g.g_id, g.g_title, g.g_icon, g.g_dohtml $join_get_fields

       FROM ibf_posts p

         LEFT JOIN ibf_members m ON (p.author_id=m.id)

         LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)

         $join_profile_query

         WHERE p.topic_id='".$this->topic['tid']."' and p.queued !='1'

         ORDER BY p.{$ibforums->vars['post_order_column']} {$ibforums->vars['post_order_sort']} LIMIT $first, ".$ibforums->vars['display_max_posts']);



We need to add two things here to the appropriate lines as above:


1. $DB->query( "SELECT d.field_1 AS 'country',p.*,                    <----- added the d.field_1 AS 'country',


2. LEFT JOIN ibf_members m ON (p.author_id=m.id)

   LEFT JOIN ibf_pfields_content d ON (p.author_id=d.member_id)       <----- added this line

   LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)



***************************************************************

Just check that 'country' in Point 1. above, is actually default field_1.  Just check back in your ACP/Users & Groups/

Custom Profile Fields.  If it is NOT field_1 change it to whatever field number it is by changing the above.

***************************************************************


***************************************************************

NOTE: If u have installed my Sex Mod, here is an example what Point 1. above should look like with the change: 


Example:    $DB->query( "SELECT d.field_1 AS 'country',d.field_5 AS 'sex',p.*,

***************************************************************



Further down Find: (around Line 1234):


  if ($member['msnname'])

  {

 	 $member['msn_icon'] = "<a href=\"javascript:PopUp('{$this->base_url}act=MSN&amp;MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_MSN}></a>";

  }

  

Add directly below: 


  // Flag Hack:

  

  if ($member['country'] != "" AND $member['country'] != "-")

  {

 	 $member['country'] =  "<img title='{$member['country']}' src='{$ibforums->vars['FLAGS_URL']}/{$member['country']}.gif' border='0'></a>";

  } else {

 	 $member['country'] = "<img src='{$ibforums->vars['FLAGS_URL']}/blank.gif' border='0'>";

  }

  //-----------------------------------------------------



=======

SAVE

=======


..

Ich will aber die Anzeige nur im Profil, nicht in der Topicansicht..

Wo kann ich denn diese Änderungen in der Profile.php einbauen, damit es nur im Profil angezeigt wird?

(die Änderungen in der skin_profile.php bekomm' ich dann hoffentlich selbst hin ;) ).

mfg,

Tom

Share this post


Link to post

Ich muss das jetzt mal bumpen, weil's doch schon einige Zeit her ist und meine "Selbstversuche" bisher nicht von Erfolg gekrönt waren.. :lol:

Ich hab' versucht, das in die Profile.php einzubauen, angelehnt an den Teil, wo's um msnname geht

   	 $info['msn_name']    = $member['msnname']    ? $member['msnname']    : $ibforums->lang['no_info'];

weil's in der Topics.php diesem Teil (msnname) ähnlich ist..

Hab's aber - wie gesagt - nicht hinbekommen.. :(

Könnte mir jemand helfen, diesen hack so "hinzubiegen"?

mfg,

Tom

Share this post


Link to post

Öffne mal die Profile.php und suche folgende Stelle:

      $custom_out .= $this->html->custom_field($row['ftitle'], $field_data[ $row['fid'] ] );
   }

   if ($custom_out != "")
   {
     $this->output = str_replace( "<!--{CUSTOM.FIELDS}-->", $custom_out, $this->output );
   }

   //---------------------------------------------------
   // Warning stuff!!
   //---------------------------------------------------
Direkt darüber setze mal folgendes:
            if ($row['fid'] == X AND $field_data[ $row['fid'] != "" AND $field_data[ $row['fid'] != "-")
           {
           $field_data[ $row['fid'] ] = "<img title='{$field_data[ $row['fid'] ]}' src='{$ibforums->vars['FLAGS_URL']}/{$field_data[ $row['fid'] ]}.gif' border='0'></a>";
           } else {
             $field_data[ $row['fid'] ] = "<img src='{$ibforums->vars['FLAGS_URL']}/blank.gif' border='0'>";
           }

Für das X muß die ID des Feldes eingesetzt werden. Also wenn es field_1 ist, dann muß dort die 1 hin. Hoffe, das es funktioniert, hab es jetzt nicht getestet.

Share this post


Link to post

Hallo Stefan,

danke für Deine Hilfe! :)

Es funktioniert schon fast.. ;)

Zuerst kam ein Fehler "..unexpected ')' .. expected ']' .. " - ich hab's daher mal so gemacht:

if ($row['fid'] == 5 AND $field_data[ $row['fid'] ] != "" AND $field_data[ $row['fid'] ] != "-")

..

Gleichzeitig hab' ich das "</a>" rausgenommen, das auch in der Anleitung vorkommt, aber wohl wenig Sinn macht..?

Jetzt wird das Feld, oder besser gesagt: die Flagge schon angezeigt :) , aber leider meine beiden anderen Custom profile fields nicht mehr.. :(

Ich schau' mir das noch ein bissl an..

[edit] es wird jetzt auch als Eintrag für die beiden anderen Custom fields "/flags/blank.gif" verwendet.. ;)

Aber eigentlich sollte doch mit "if ($row['fid'] == 5 .." festgelegt sein, dass das nur für Feld X (also in meinem Fall 5) gilt..?

Lg,

Tom

Edited by TomCrow

Share this post


Link to post

Sorry, war wohl noch zu früh am Morgen. :lol:

Was du neu eingefügt hast, ersetze mal durch:

if ($row['fid'] == 5)
{
           if ($field_data[ $row['fid'] ] != "" AND $field_data[ $row['fid'] ] != "-")
          {
           $field_data[ $row['fid'] ] = "<img title='{$field_data[ $row['fid'] ]}' src='{$ibforums->vars['FLAGS_URL']}/{$field_data[ $row['fid'] ]}.gif' border='0' />";
          } else {
             $field_data[ $row['fid'] ] = "<img src='{$ibforums->vars['FLAGS_URL']}/blank.gif' border='0' />";
          }
}

Dann sollte es funktionieren und wegen dem </a>, da hab ich einfach aus der obrigen Anleitung die Sache kopiert ohne weiter drauf zu schauen. ;)

Share this post


Link to post

:thumb_up: Yup, haut hin - perfekt! Vielen Dank, Stefan!! :)

Mann, Dich müsste man mal ein Wochenende "mieten" können, dann hätte man alle mods & hacks so, wie ich sie gern hätt'.. :w00t:

Lg,

Tom

Share this post


Link to post

Also wenn man mir soviel Honig um den Bart schmiert, da kann ich ja nur die Anfragen von dir schnellstens abarbeiten. :lol::lol:

Mod zu dem Problem ist programmiert und zu dir auf den Weg. :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×