Thank you Jens for your guidance.
I will post my results here.
Date: Wed, 15 Aug 2018 09:20:12 +0200
From: Jens Wahnes <wah...@uni-koeln.de>
Subject: Re: [imp] changing signature at once for all users
Cristian-Petru Pencov wrote:
I'm again in situation to replace some text in user's signature for
more than fifty accounts.
with the usual "SQL database" backend for preference storage, it is
possible to write code that retrieves the individual users'
"identities" preferences (they are serialized PHP objects and can be
unserialize()d). Note that one user can have several identities, so
for each user, you are looking at an array of arrays. Then, there
is both a "signature" and a "signature_html" preference. While
parsing and manipulating the normal signature with preg_replace or
such shouldn't be too hard to do, things get a bit more complicated
when you're dealing with HTML code. Depending on what you would like
to change in every user's signature (e.g. phone number or postal
address), you might have a hard time parsing the HTML code since
users may have selected to use a different font (small, bold,
whatever) for parts of the signature, and they might even have done
so accidentally. For instance, imagine you're trying to put a new
phone number into everyone's signatures, but some user has got
opening or closing HTML tags inside the phone number because they
missed to select one digit of the phone number when they edited
their signature and put all other digits of the phone number into
boldface. That really is one mess to sort out if all you wanted to
do is write one small script to adapt you users' signatures. Oh,
and you'll have to serialize() that stuff and write it back to the
database once you've walked through each user's array of identities.
Better have a backup of the old data, too, in case something goes
wrong.
Jens
--
Cu stima,
Cristian-Petru Pencov
IT specialist
ARTMATCH SRL
Calea Sagului (DN 59), KM 8+550 m
Platforma Incontro, Hala 4-7
307221 Chisoda, Timis, Romania
mobile: +4 0721-202989 | fax: +4 0256-305015
e-mail: cristian.pen...@artmatch.ro | internet: www.artmatch.ro
http://www.shopping-basket.net
Please consider the environment before printing this email.
.
--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org