Hi,
I created a new column in xf_user and created a code event listener on entity_structure. The new column is integer and defaults to 0. My Listener callback function is this:
I made changes to the templates and I call $user.user_show_cup to show the result on the user's profile. It works.
Now the problem is that whenever I try to post/reply/login etc I get
I am not very familiar with XF2 so I don't really know what the correct way of setting entities is. (I've read the dev manual).
It is important to note that this column should not be updated from any screen. It is not meant to be updated by the front-end, only read.
Any ideas?
I created a new column in xf_user and created a code event listener on entity_structure. The new column is integer and defaults to 0. My Listener callback function is this:
PHP:
namespace MyApp\Main;
use XF\Mvc\Entity\Entity;
class Listener {
public static function userShowCup(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure) {
$structure->columns['user_show_cup'] = ['type' => Entity::INT, 'default' => 0];
}
}
I made changes to the templates and I call $user.user_show_cup to show the result on the user's profile. It works.
Now the problem is that whenever I try to post/reply/login etc I get
PHP:
XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'user_show_cup' in 'on clause' in src/XF/Db/AbstractStatement.php at line 212
I am not very familiar with XF2 so I don't really know what the correct way of setting entities is. (I've read the dev manual).
It is important to note that this column should not be updated from any screen. It is not meant to be updated by the front-end, only read.
Any ideas?
Last edited: