The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.18 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A patching question..
#1
Hi, so I'm relatively new to user spice but firstly thank goodness for this - my life is truly easier.

I am currently editing user profiles, changing columns etc. etc. For example, my users dont need to specify a first/last name, so effectively want to delete the cols. How does this work in userspice from a general point of view (does it break anything?) and does it effect the next patches - am I going to run into problems by deleting/modifying the default columns?

Thanks in advance
  Reply
#2
Awesome. Glad you're liking it so far.

In general, there's not really a performance benefit to deleting those columns. I don't think you'll run into issues as far as patching is concerned, though.

Basically, you'll want to do a find through the code and look for anything that calls $user->data()->fname and lname. I've programmed a lot of that out through the echouser function (so you can just set that to Username) in the admin dashboard. The only place I can think you might run into issues is on some of the email things and the user_settings page.

Anything you change that is a "core" userspice file should be done in usersc/

You'll have to change the path to the includes, etc, but the gist of it is that if you've modded a file (let's say login.php) if yours is in usersc/login.php it will ignore the core one and use yours, so the patches will not break your mods.
  Reply
#3
Thanks mudmin..

One more question.. I'm trying to create queries to my dB which obviously userspice uses.. I don't want to effectively open up two connections if userspice already has one open.. Is there a way of using user spice to query the dB..
  Reply
#4
Mudmin made this awesome video below that will guide you through interacting with the DB:
https://www.youtube.com/watch?v=rb0kD5tCENM
  Reply
#5
Great that's exactly what I needed.. thanks both - now lets pray that userspice never retires..
  Reply
#6
speaking of the db, I'm comfortable creating a patch file to update or create table/rows/columns etc, until i want to add multiple values to multiple columns, for example:

lets say my table is:
<pre>
Code:
$ctr1 = $db->query("CREATE TABLE <code>poppies</code> (
  <code>id</code> int(11) NOT NULL,
  <code>name</code> varchar(50) NOT NULL,
  <code>alpha_2</code> varchar(2) NOT NULL,
  <code>alpha_3</code> varchar(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1");

$ctr2 = $db->query("ALTER TABLE <code>poppies</code> ADD PRIMARY KEY (<code>id</code>)");
$ctr3 = $db->query("ALTER TABLE <code>poppies</code> MODIFY <code>id</code> int(11) NOT NULL AUTO_INCREMENT");
</pre>

now i want to update the table with multiple values for each column, for instance in column "name" i have 20 poppy names i need inserting,

normally if it was one value i would just do this:

<pre>
Code:
$fields = array(
  'name'  => 'yellow poppy',
  'alpha_2'  => '',
  'alpha_3'  => '',
);
$ctr4 = $db->insert('poppies',$fields);
</pre>


can user spice handle this ? or do i just have to import .sql via phpmyadmin?
  Reply
#7
@wickey312, I've built too many of my own projects on userspice to let it go away! haha. Although from May-August 1 are my crazy busy times at work so I don't get to do as much support and patching as I would like to.

I run a 500 acre kids camp up in Alaska, so when the sun is out, so are Alaskans!
  Reply
#8
@firestorm

I almost always do that with some sort of foreach loop.

I guess it depends. If I am entering the data in myself for the first time...I just go into phpmyadmin and do it that way. If I'm auto-generating the content from some sort of other query, I almost always go through a foreach.
  Reply
#9
@firestorm

https://pastebin.com/Jp2EbDTw (line 202)

I've rewritten insert function so that you can add more than one record to a table.

Example:

Code:
$fields = array (
Code:
"Number" => array(1,2),
Code:
"Letter" => array("A","B")
Code:
);
Code:
$db -> insert("test_table",$fields);
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)