Sales Question?
Willkommen, Gast

THEMA: email template show user group

Re: email template show user group 1 Jahr, 2 Monate her #69169

TheMuffinMan schrieb:
Hi,

try this:

add a hidden input to your form and use this as default value:

<?php $gnames = ''; $groups = JFactory::getUser()->get('groups'); foreach($groups as $groupName=>$groupId) {  $gnames .=  $groupName . ' '}; return $groups;   ?>


The code above is only getting the User Group ID number. How do I get the "Group Title"?
  • modernmagic
  • OFFLINE
  • Expert Boarder
  • Beiträge: 99
  • Karma: 0
Joomla website design and management modernmagic.com

Re: email template show user group 1 Jahr, 2 Monate her #69269

Hi,

no, according to the joomla docs it will return the names, since the group names are the keys of the group IDs.
If this is not working, probably because the jdocs are outdated, you can try this:

<?php $db = JFactory::getDbo(); $db->setQuery("Select `id`,`title` From #__usergroups");$ugs = $db->loadObjectList();$usergroups = array();foreach($ugs As $ug){$usergroups[$ug->id] = $ug->title;}$gnames = ''; $groups = JFactory::getUser()->get('groups'); foreach($groups as $groupName=>$groupId) { $gnames .=  $usergroups[$groupId] . ' '; }; return $groups; ?>


Regards,
Markus
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re: email template show user group 1 Jahr, 2 Monate her #69433

It doesn't appear that I can past that into the /media/mailtpl/mailbacktpl.txt.php

Is there a way to just put the query there instead of adding it to are dozens of forms?
  • modernmagic
  • OFFLINE
  • Expert Boarder
  • Beiträge: 99
  • Karma: 0
Joomla website design and management modernmagic.com

Re: email template show user group 1 Jahr, 2 Monate her #69632

Hi,

I think you can, just replace "return" in the above piece of code by "echo" and it should get printed there.

Regards,
Markus
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================

Re: email template show user group 1 Jahr, 2 Monate her #69712

I did that but now I just get the word "Array"

<?php
/**
* BreezingForms - A Joomla Forms Application
* @version 1.7.3
* @package BreezingForms
* @copyright (C) 2008-2011 by Markus Bopp
* @license Released under the terms of the GNU General Public License
**/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>

<?php $db = JFactory::getDbo(); $db->setQuery("Select `id`,`title` From #__usergroups");$ugs = $db->loadObjectList();$usergroups = array();foreach($ugs As $ug){$usergroups[$ug->id] = $ug->title;}$gnames = ''; $groups = JFactory::getUser()->get('groups'); foreach($groups as $groupName=>$groupId) { $gnames .=  $usergroups[$groupId] . ' '; }; echo $groups; ?>

<?php echo $PROCESS_SUBMITTERFULLNAME ?>: <?php echo $SUBMITTERFULLNAME ?><?php echo $NL ?>
<?php echo $userGroup ?>
<?php echo $PROCESS_FORMTITLE ?>: <?php echo $TITLE ?><?php echo $NL ?>
<?php foreach ($MAILDATA as $DATA): ?>
<?php echo $DATA[_FF_DATA_TITLE]?>: <?php echo $DATA[_FF_DATA_VALUE]?><?php echo $NL ?>
<?php endforeach; ?>

<?php if ($RECORD_ID != ''): ?>
<?php echo $PROCESS_RECORDSAVEDID?> <?php echo $RECORD_ID ?><?php echo $NL ?>
<?php endif; ?>


The email looks like this:

ArrayUser full name: Jeff Mayland
Form title: stairstepinserts
Quick Order: 500

Record saved to database with ID: 200
  • modernmagic
  • OFFLINE
  • Expert Boarder
  • Beiträge: 99
  • Karma: 0
Joomla website design and management modernmagic.com

Re: email template show user group 1 Jahr, 2 Monate her #69864

Hi,

what does this return?

<?php $db = JFactory::getDbo(); $db->setQuery("Select `id`,`title` From #__usergroups");$ugs = $db->loadObjectList();$usergroups = array();foreach($ugs As $ug){$usergroups[$ug->id] = $ug->title;}$gnames = ''; $groups = JFactory::getUser()->get('groups'); foreach($groups as $groupName=>$groupId) { $gnames .=  $usergroups[$groupId] . ' '; }; return implode(', ', $groups); ?>


Regards,
Markus
===============================================
Satisfied?
Consider a membership!
===============================================
Like us on Facebook
===============================================
Follow us on Twitter
===============================================
Letzte Änderung: 1 Jahr, 2 Monate her von TheMuffinMan.
Moderatoren: TheMuffinMan, ForumSupport
Ladezeit der Seite: 0.38 Sekunden

Über Crosstec

Crosstec GmbH & Co. KG

Hohenzollernring 57

50672 Cologne, Germany