Bienvenido, Invitado
Nombre de Usuario Contraseña: Recordarme

Adding new fields in Kunena Config for JS plugin
(1 viendo) (1) Invitado
  • Página:
  • 1

TEMA: Adding new fields in Kunena Config for JS plugin

Adding new fields in Kunena Config for JS plugin hace 2 años, 2 meses #13755

JoniJnm wrote:
Hi,

You can add it manually. For example, if you want add a field which show the user's country:

{Kunena}/JoniJnm_plugins/plugins/jomosocial/jomsocial.xml
add:

<param type="text" name="country" default="0" title="Country" />

{Kunena}/JoniJnm_plugins/plugins/jomosocial/helper.php
add (in the integration function, in "foreach"):

elseif ($dato->field_id == $plugin->getParam("country", 0)) {
$userinfo->country = $dato->value;
}

Later, in the file {template}/message.php, search:
if (isset($msg_birthdate)) {
echo $msg_birthdate;
}

and add later:
if (isset($userinfo->country)) {
echo $userinfo->country;
}


Thank you for amazing work! I was waiting for something like that! Tryin first to migrate to phpBB3 but you stopped me! Thanks.

And my question about above modification - can't add dditionaal info. For example I would like to add 2 fields - home town and city. In JS those fields are named
    Miasto w PL - for hometown Miasto w UK - for city


and... doesn't show enything. I mean only DOB and gender is showin. And I've tryied in Kunena Configuration assing different value to gender and DOB than default and it change nothing.

My code for
jomsocial.xml
		<param type="text" name="gender" default="2" title="K_JOMSOCIAL_GENDER" />
<param type="text" name="hometown" default="4" title="Miasto w PL" />
<param type="text" name="city" default="11" title="Miasto w UK" />
<param type="text" name="signature" default="0" title="K_JOMSOCIAL_SIGNATURE" />
<param type="text" name="country" default="0" title="Country" />


helper.php
				elseif ($dato->field_id == $plugin->getParam("birthdate", 3)) {
$userinfo->birthdate = explode(" ",$dato->value);
$userinfo->birthdate = $userinfo->birthdate[0];
}
elseif ($dato->field_id == $plugin->getParam("country", 0)) {
$userinfo->country = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("gender", 2)) {
$userinfo->gender = "";
$kunena_db->setQuery("SELECT options FROM #__community_fields WHERE id=".$dato->field_id);
$options = explode("\n", $kunena_db->loadResult());
$i=0;
while (!$userinfo->gender && $i<count($options)) {
if ($options[$i] == $dato->value) {
$userinfo->gender = $i+1;
}
$i++;
}
}
elseif ($dato->field_id == $plugin->getParam("hometown", 4)) {
$userinfo->country = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("city", 11)) {
$userinfo->country = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("signature", 0)) {
$userinfo->signature = $dato->value;
}


message.php
                    <?php
if (isset($msg_birthdate)) {
echo $msg_birthdate;
}
if (isset($userinfo->hometown)) {
echo $userinfo->hometown;
}
if (isset($userinfo->city)) {
echo $userinfo->city;
}
}
?>


Thanks in advance for your reply!


:*
  • MuicInMe
  • DESCONECTADO
  • Visitante
  • Temas: 1
  • Karma: 0
Última Edición: hace 2 años, 2 meses Por JoniJnm.
El tema ha sido cerrado.

Re: Adding new fields in Kunena Config for JS plugin hace 2 años, 2 meses #13761

Hi,

Helper.php should be:
				elseif ($dato->field_id == $plugin->getParam("birthdate", 3)) {
$userinfo->birthdate = explode(" ",$dato->value);
$userinfo->birthdate = $userinfo->birthdate[0];
}
elseif ($dato->field_id == $plugin->getParam("country", 0)) {
$userinfo->country = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("gender", 2)) {
$userinfo->gender = "";
$kunena_db->setQuery("SELECT options FROM #__community_fields WHERE id=".$dato->field_id);
$options = explode("\n", $kunena_db->loadResult());
$i=0;
while (!$userinfo->gender && $i<count($options)) {
if ($options[$i] == $dato->value) {
$userinfo->gender = $i+1;
}
$i++;
}
}
elseif ($dato->field_id == $plugin->getParam("hometown", 4)) {
$userinfo->hometown = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("city", 11)) {
$userinfo->city = $dato->value;
}
elseif ($dato->field_id == $plugin->getParam("signature", 0)) {
$userinfo->signature = $dato->value


Changed:
$userinfo->hometown = $dato->value;
$userinfo->city = $dato->value;

If it doesn't work let me see your website
  • JoniJnm
  • DESCONECTADO
  • Administrador
  • Temas: 4167
  • Karma: 144
Última Edición: hace 2 años, 2 meses Por JoniJnm.
El tema ha sido cerrado.
  • Página:
  • 1
Página generada en: 0.71 segundos