Jump to content

Generic "something went wrong" using exact code example


demeto

Recommended Posts

I used exactly the code example given here but it returns a very generic error. "something went wrong,please try again."

//2) Reading the Community Suite session
/* Require the init.php file from the Community Suite root directory */
require 'init.php';// im in the exact same folder as init.php

/* Initiate the session to verify who this user is */
\IPS\Session\Front::init(); // this line is causing problems it seems but puts out useless errors

/* Print the user's name */
print \IPS\Member::loggedIn()->name;


 

Is there a way to show more debugging messages or something? These messages are completely use less for debugging :)

I'm in the exact same folder as init.php

Would be very useful to know (i) how to extend the error message information, (ii) how to get this working.

Link to comment
Share on other sites

I used exactly the code example given here but it returns a very generic error. "something went wrong,please try again."

//2) Reading the Community Suite session
/* Require the init.php file from the Community Suite root directory */
require 'init.php';// im in the exact same folder as init.php

/* Initiate the session to verify who this user is */
\IPS\Session\Front::init(); // this line is causing problems it seems but puts out useless errors

/* Print the user's name */
print \IPS\Member::loggedIn()->name;


 

Is there a way to show more debugging messages or something? These messages are completely use less for debugging :)

I'm in the exact same folder as init.php

Would be very useful to know (i) how to extend the error message information, (ii) how to get this working.

​.

Can you try this one ?

replace path/to/your/init.php

added some extra variables ..

 

<?php
    require_once( 'path/to/your/init.php' );
    \IPS\Session\Front::i();
    $memCSRF = \IPS\Session::i()->csrfKey;
    $member = \IPS\Member::loggedIn();
    $memName = $member->name;
    $memEmail = $member->email;
    $memID = $member->member_id;

 

 

.

Link to comment
Share on other sites

@IN10TION, thanks that works, although it mildly surprises me the code example from the documentation is wrong :)

 

$member = \IPS\Member::loggedIn(); // this is very helpful thank you
var_dump($member);

Do you also happen to know where I could find other functions like this for for instance Topic data?

Link to comment
Share on other sites

@IN10TION, thanks that works, although it mildly surprises me the code example from the documentation is wrong :)

 

$member = \IPS\Member::loggedIn(); // this is very helpful thank you
var_dump($member);

Do you also happen to know where I could find other functions like this for for instance Topic data?

​.

It depends a bit how your templates interact with each other and where you are at to make changes ..

Are you in your theme templates ?

 

.

Link to comment
Share on other sites

I'm in both my theme templates as in an application that uses your code example. What I want to do is make sure that the topic someone views is actually send to the session so the external app sees it (going to fiddle a bit with ajax) :)

In IPS3 i just did this by using something like

session_start(); // in index.php
......
$_SESSION['topicid'] = isset($topic['tid']) ? $topic['tid'] : 0 ; // in the topicViewTemplate ips3

Not sure though if i can freely use sessions in ips4 as I could with ips3 or if it requires additional functions. (the native $_SESSION's array seem empty though so apparently it is not used)

Link to comment
Share on other sites

I'm in both my theme templates as in an application that uses your code example. What I want to do is make sure that the topic someone views is actually send to the session so the external app sees it (going to fiddle a bit with ajax) :)

In IPS3 i just did this by using something like

session_start(); // in index.php
......
$_SESSION['topicid'] = isset($topic['tid']) ? $topic['tid']: 0 ; // in the topicViewTemplate ips3

Not sure though if i can freely use sessions in IPS4 as I could with ips3 :)

​.

No idea for the sessions ..

Topic id is like this now (if your theme passes the $topic variable to your template) ..

$topic->tid

 

.

Link to comment
Share on other sites

​.

No idea for the sessions ..

Topic id is like this now (if your theme passes the $topic variable to your template) ..

$topic->tid

 

.

​Super thanks a lot mate! I found this one also for the forumview (multiple topics)

template code:              data-rowID='{$row->$idField}' // in themes / forums / topicRow

Thanks again for the help!!

Link to comment
Share on other sites

​Super thanks a lot mate! I found this one also for the forumview (multiple topics)

template code:              data-rowID='{$row->$idField}' // in themes / forums / topicRow

Thanks again for the help!!

​.

Just wanted to reply .. {{foreach $rows as $row}} is mostly used with $idField as {{$idField = $row::$databaseColumnId;}} ..

Will be a bit of trial and error to puzzle it  :)  .. 

 

.

Link to comment
Share on other sites

​.

Just wanted to reply .. {{foreach $rows as $row}} is mostly used with $idField as {{$idField = $row::$databaseColumnId;}} ..

Will be a bit of trial and error to puzzle it  :)  .. 

 

.

​Ok cool good to know, I'll fiddle around, cheers!! :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...