News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Displaying users in tree, with links to account

Started by bobsburgers, October 12, 2014, 09:19:14 PM

Previous topic - Next topic

bobsburgers

currently I am using the below code to help display SMF invites in a tree. I need to display the link to the users account not just the text of their username. Still figuring out SMF...


   

            echo "<script type='text/javascript' src='.google.com/jsapi'></script>
        <script type='text/javascript'>
          google.load('visualization', '1', {packages:['orgchart']});
          google.setOnLoadCallback(drawChart);
          function drawChart() {
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Text');
            data.addColumn('string', 'Invited_by');
            data.addColumn('string', 'Id');
            data.addRows([";
        foreach ($context['invite'] as $invited_by => $level)
            {
            foreach ($level as $invited)
                    {
                            echo '
                                    [{v:"'.$invited['name'].'",f:"'.$invited['text'].'<div style=\"color:red; font-style:italic\">'.$invited['tag'].'</div>"},"'.$invited_by.'","'.'id'.'"],';
                    }
            }
           
            echo "]);var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
            chart.draw(data, {allowHtml:true});
          }
        </script>


margarett

SMF has no invitations system, so I assume you're using a MOD for that. I don't know what's inside "$context['invite']" but you can do, before that script:
echo '<pre>';
print_r($context['invite']):
echo '</pre>';

With that we should be able to see what's there to add. BTW, do you want a link to both inviter and invitee?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: