Hallo, Gast! (Registrieren)

Wir wünschen allen Besuchern frohe und besinnliche Weihnachten!

Letzte Ankündigung: MyBB 1.8.38 veröffentlicht (30.04.24)


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste
Kein Wert wird in der DB gespeichert
#1
Hallo Community,

Ich habe mein eigenes erstes Plugin gemacht. Und jetzt treten die Probleme auf. Die SuFU hat nix vernüftiges geliefert.

Es handelt sich um ein Plugin, dass erlaubt, einen Link zum YouTube-Channel (nur Name!) im Profil einzubinden.

Jedoch wird kein Wert in der DB gespeichert. Auch durch manuelle Code-Eingabe ins Profil. Jetzt kommt das komische: Bevor ich das Plugin im Board eingesetzt habe, gings noch.

Zitat:URL zum Forum http://tinyurl.com/yexyjnr
Welche Styles nutzt du? Lightblue
Hast du Mods installiert? Welche? Ist hoffe ich lesbar: http://imgbox.de/users/FalkenaugeMihawk/...rsicht.jpg
Welche MyBB version benutzt du? 1.4.11
Welche PHP-Version benutzt du? 5.2.6-1+lenny3
Welche Datenbank benutzt du? (mit Version) MySQLi 5.0.51
Hast du ein Update/Upgrade durchgeführt? Nein.
Hast du dein MyBB Forum von einer anderen Boardsoftware konvertiert? Nein.
Seit wann tritt das Problem auf? Seitdem ich das Plugin aktiviert habe.
Wird eine Fehlermeldung ausgegeben? Welche? Wann? Nein.

Code im Script:
Code:
<?php

if(!defined("IN_MYBB"))
{
  die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("datahandler_user_update", "ytprofile_update");

function ytprofile_info()
{
  return array(
        "name"            => "YouTube Channel im Profil",
        "description"    => "Erlaubt im Profil den Namen eines YouTube Channels anzugeben, der dann als Direktlink angezeigt wird.",
        "website"        => "http://falkenauge.kilu.de",
        "author"        => "Daniel Gatti",
        "authorsite"    => "http://falkenauge.kilu.de",
        "version"        => "1.0",
        "guid"            => "a2ab1c6951e53e14ca6528fc61fe2d50",
        "compatibility" => "14*",
  );
}

function ytprofile_activate()
{
  global $db;
  
  /* TODO: Should the possibility be added to disable ytprofile from admin cp? */
  $db->query("ALTER TABLE ".TABLE_PREFIX."users  ADD ytprofile VARCHAR(100) NOT NULL AFTER website");
  
  /* TODO: Language support? */
  require_once MYBB_ROOT."inc/adminfunctions_templates.php";

  /* Insert fields into usercp for editing */
  find_replace_templatesets('usercp_profile','#'.preg_quote('{\$user[\'website\']}" /></td>').'#',
        '{$user[\'website\']}" /></td>
</tr>
<tr>
<td colspan="3"><span class="smalltext">YouTube Channel:</span></td>
</tr>
<tr>
<td colspan="3"><input type="text" class="textbox" name="YouTube Channel" size="25" maxlength="50" value="{\$user[\'ytprofile\']}" /></td>
</tr>');

  /* Insert fields into member profile */
  find_replace_templatesets('member_profile','#'.preg_quote('{$website}</td>').'#',
        '{$website}</td>
</tr>
<tr>
<td class="trow1"><strong>YouTube Channel</strong></td>
<td class="trow1"><a href="http://www.youtube.com/user/{\$memprofile[\'ytprofile\']}" target="_blank">{\$memprofile[\'ytprofile\']}</a></td>
</tr>');
}

function ytprofile_deactivate()
{
  global $db;

  $db->query("ALTER TABLE ".TABLE_PREFIX."users DROP COLUMN ytprofile");

  require_once MYBB_ROOT."inc/adminfunctions_templates.php";

  find_replace_templatesets('usercp_profile',
      preg_quote('#{$user[\'website\']}" /></td>
</tr><tr>
<td colspan="3"><span class="smalltext">YouTube Channel:</span></td>
</tr>
<tr>
<td colspan="3"><input type="text" class="textbox" name="YouTube Channel" size="25" maxlength="50" value="{$user[\'ytprofile\']}" /></td>
</tr>#'),
      '{$user[\'website\']}" /></td>',0);

   find_replace_templatesets('member_profile',
        preg_quote('#{$website}</td>
</tr>
<tr>
<td class="trow1"><strong>YouTube Channel</strong></td>
<td class="trow1"><a href="http://www.youtube.com/user/{$memprofile[\'ytprofile\']}" target="_blank">{$memprofile[\'ytprofile\']}</a></td>
</tr>#'),
      '{$website}</td>',0);
}

function ytprofile_update($ytprofile)
{
  global $mybb;

  if (isset($mybb->input['ytprofile']))
   {
      $ytprofile->user_update_data['ytprofile'] = $mybb->input['ytprofile'];
   }
}

Code im Template:
usercp_profile:
Code:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->edit_profile}</title>
{$headerinclude}
</head>
<body>
{$header}
<form action="usercp.php" method="post" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
{$errors}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->edit_profile}</strong></td>
</tr>
<tr>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>{$lang->profile_required}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<tr>
<td colspan="2"><span class="smalltext"><strong>{$lang->change_email_notice}</strong></span></td>
</tr>
{$requiredfields}
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>{$lang->profile_optional}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<tr>
<td colspan="3"><span class="smalltext">{$lang->birthday}</span></td>
</tr>
<tr>
<td>
<select name="bday1">
<option value="">&nbsp;</option>
{$bdaydaysel}
</select>
</td>
<td>
<select name="bday2">
<option value="">&nbsp;</option>
<option value="1" {$bdaymonthsel['1']}>{$lang->month_1}</option>
<option value="2" {$bdaymonthsel['2']}>{$lang->month_2}</option>
<option value="3" {$bdaymonthsel['3']}>{$lang->month_3}</option>
<option value="4" {$bdaymonthsel['4']}>{$lang->month_4}</option>
<option value="5" {$bdaymonthsel['5']}>{$lang->month_5}</option>
<option value="6" {$bdaymonthsel['6']}>{$lang->month_6}</option>
<option value="7" {$bdaymonthsel['7']}>{$lang->month_7}</option>
<option value="8" {$bdaymonthsel['8']}>{$lang->month_8}</option>
<option value="9" {$bdaymonthsel['9']}>{$lang->month_9}</option>
<option value="10" {$bdaymonthsel['10']}>{$lang->month_10}</option>
<option value="11" {$bdaymonthsel['11']}>{$lang->month_11}</option>
<option value="12" {$bdaymonthsel['12']}>{$lang->month_12}</option>
</select>
</td>
<td>
<input type="text" class="textbox" size="4" maxlength="4" name="bday3" value="{$bday['2']}" />
</td>
<tr>
<td colspan="3"><span class="smalltext">{$lang->website_url}</span></td>
</tr>
<tr>
<td colspan="3"><input type="text" class="textbox" name="website" size="25" maxlength="75" value="{$user['website']}" /></td>
</tr>
<tr>
<td colspan="3"><span class="smalltext">YouTube Channel:</span></td>
</tr>
<tr>
<td colspan="3"><input type="text" class="textbox" name="ytprofile" size="25" maxlength="50" value="{$user['ytprofile']}" /></td>
</tr>
</table>
</fieldset>
{$customfields}
</td>
<td width="50%" class="trow1" valign="top">
{$customtitle}
<fieldset class="trow2">
<legend><strong>{$lang->additional_contact_details}</strong></legend>
<table cellspacing="0" cellpadding="{$theme['tablespace']}">
<tr>
<td><span class="smalltext">{$lang->icq_number}</span></td>
</tr>
<tr>
<td><input type="text" class="textbox" name="icq" size="25" value="{$user['icq']}" /></td>
</tr>
<tr>
<td><span class="smalltext">{$lang->msn}</span></td>
</tr>
<tr>
<td><input type="text" class="textbox" name="msn" size="25" value="{$user['msn']}" /></td>
</tr>
</table>
</fieldset>
{$awaysection}
</td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="do_profile" />
<input type="submit" class="button" name="regsubmit" value="{$lang->update_profile}" />
</div>
</td>
</tr>
</table>
</form>
{$footer}
</body>
</html>

member_profile:
Code:
<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->profile}</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1">
<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td class="trow1" width="75%">
<span class="largetext"><strong>{$formattedname}</strong></span><br />
<span class="smalltext">
({$usertitle})<br />
{$groupimage}
{$userstars}<br />
<br />
<strong>{$lang->registration_date}</strong> {$memregdate}<br />
<strong>{$lang->date_of_birth}</strong> {$membday} {$membdayage}<br />
<strong>{$lang->local_time}</strong> {$localtime}<br />
<strong>{$lang->postbit_status}</strong> {$online_status}
</span>
</td><td width="25%" align="right" valign="middle">{$avatar}</td></tr></table>
</td>
</tr>
{$awaybit}
</table>
<br />
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td width="50%" valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_forum_info}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->joined}</strong></td>
<td class="trow1">{$memregdate}</td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->lastvisit}</strong></td>
<td class="trow2">{$memlastvisitdate} {$memlastvisittime}</td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->total_posts}</strong></td>
<td class="trow1">{$memprofile['postnum']} ({$lang->ppd_percent_total})<br /><span class="smalltext">(<a href="search.php?action=finduserthreads&amp;uid={$uid}">{$lang->find_threads}</a> &mdash; <a href="search.php?action=finduser&amp;uid={$uid}">{$lang->find_posts}</a>)</span></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->timeonline}</strong></td>
<td class="trow2">{$timeonline}</td>
</tr>
{$reputation}
{$warning_level}
</table>
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>{$lang->users_contact_details}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->homepage}</strong></td>
<td class="trow1">{$website}</td>
</tr>
<tr>
<td class="trow1"><strong>YouTube Channel</strong></td>
<td class="trow1"><a href="http://www.youtube.com/user/{$memprofile['ytprofile']}" target="_blank">{$memprofile['ytprofile']}</a></td>
</tr>
{$sendemail}
<tr>
<td class="trow2"><strong>{$lang->pm}</strong></td>
<td class="trow2"><a href="private.php?action=send&amp;uid={$memprofile['uid']}">{$lang->send_pm}</a></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->icq_number}</strong></td>
<td class="trow1"><a href="javascript:;" onclick="MyBB.popupWindow('misc.php?action=imcenter&amp;imtype=icq&amp;uid={$uid}', 'imcenter', 450, 300);">{$memprofile['icq']}</a></td>
</tr>
<tr>
<tr>
<td class="trow2"><strong>{$lang->msn}</strong></td>
<td class="trow2"><a href="javascript:;" onclick="http://forum.game-news.mph-p.de/misc.php?action=imcenter&imtype=icq&uid=11">{$memprofile['msn']}</a></td>
</tr>
</table>
</td>
<td><img src="{$theme['imgdir']}/pixel.gif" height="1" width="8" alt=""/></td>
<td width="50%" valign="top">
{$profilefields}
{$signature}
{$modoptions}
</td>
</tr>
</table>
{$footer}
</body>
</html>

Ich hoffe, ihr könnt mir helfen.
Zitieren
#2
https://www.mybb.de/forum/thread-22099-p...#pid152887
viele Grüße
Jockl
übersetzte und eigene Plugins
Zitieren
#3
Funktioniert jetzt.
Zitieren


Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Auf "Forum Display" einen Wert aus der Datenbank abrufen fernhafen 8 1.992 03.02.2022, 23:41
Letzter Beitrag: fernhafen